On 11/18/08, Christophe Leske <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  pardon me if this is a pretty easy SQL question, yet i am after a
>  statement compound which applies just ONE where clause to a group of
>  tables.
>
>  Something like
>
>  select * from c1,c2,c3....    where foo1<10
>
>  with foo1 being in all of the specified tables. So far, all i can see is
>  that I have to build several statements which all have the where clause
>  in there.

Igor has already provided a solution. Going forward, the main thing to
keep in mind is that the FROM clause looks for a single conceptual
table even though it seems like you can put multiple tables in there.
When you add multiple tables into the FROM clause, you make a single
conceptual table out of them by using the JOIN operator. If you don't
do so you create what is called a cartesian product of the tables...
that is, all rows in table 1 multiplied by all rows in table 2
multiplied by all rows in... you get the idea... an awfully large
number, and certainly not what you intended.

If you want the same query out of a number of different tables that
are identical, and join the results together, then you use the UNION
clause... in other words, you do indeed perform the SELECTs separately
and then UNION them together, but you have to apply the WHERE
constraint only once because all the tables are identical.



>
>
>  IsnĀ“t there something more tersed?
>
>  --
>  Christophe Leske
>
>  www.multimedial.de - [EMAIL PROTECTED]
>  http://www.linkedin.com/in/multimedial
>  Lessingstr. 5 - 40227 Duesseldorf - Germany
>  0211 261 32 12 - 0177 249 70 31
>
>
>  _______________________________________________
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to