Re: SELECT FROM ALL TABLES
| From: | Tyler Lane | Date: | Sat, 19 Apr 2003 03:37:00 +0000 |
| Subject: | Re: SELECT FROM ALL TABLES | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27178@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Bruce Levick" <bruce@vivamotion.com>
To: <php-db@lists.php.net>
Sent: Friday, April 18, 2003 6:52 AM
Subject: [PHP-DB] SELECT FROM ALL TABLES
> Hi Guys,
> Am having a little trouble with selecting a certain piece of data from all
> tables and then displaying the results.
>
> I have 5 tables (Concepts, Illustrations, ID, Photos, Misc). All tables
have
> a column named (itemMonth). Which is simply a month of the year (any
month).
> I am trying to display the results of a SELECT query where itemMonth =
> 'April'. But can't for the life of me get the results from all the tables
to
> display from one SELECT query.
>
> So for example the display might look something like this.
>
> Here are all the new works from April (Concepts, Illustrations, ID,
Photos,
> Misc)
> Concepts 1
> Concepts 2
> Concepts 3
> Illustraion 1
> ID 1
> Photos 1
> Misc 1
> Misc 2
>
>
> There could be any number of results from either of the tables. Obviously
> only after results where itemMonth = 'April'.
>
Uhm First question is how much data are you going be pulling from these
tables?
a 100 records, a 1,000, 10,000 or more?
Joins can be costly on a database server in terms of raw disk access and cpu
time.
http://www.w3schools.com/sql/sql_join.asp
read the examples and use the particular join that would fit your data
requirements
> I have tried many combinations to get this to work. I don't think the
> solution is to produce a select query for each table, that seems a bit
code
> heavy.
>
> Sorry if I am missing something obvious....am a little tired.
>
> Bruce
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
----
Tyler Lane
tlane@lyrical.net