At 0:23 -0700 9/23/02, neal wrote:
>Yeah, you're right. That's exactly what I want but apparently it wasn't
>implemented until v4??!?!?!
>What did people do prior to version 4 when needing to query multiple tables?
>Just endure the overhead of multiple connections to the database?
Not sure why you'd need multiple *connections*. You can use multiple
*queries*, for example like this:
CREATE TABLE tmp SELECT ... FROM t1 ...
INSERT INTO tmp SELECT ... FROM t2 ...
INSERT INTO tmp SELECT ... FROM t3 ...
At the end of this, tmp will be the same as if you'd done UNION.
More precisely, as if you'd done UNION ALL, because duplicates won't
be removed. To remove them, use SELECT DISTINCT when retriving from
>From: Herman Verkade [mailto:Herman.Verkade@stripped]
>Sent: Monday, September 23, 2002 12:14 AM
>Subject: RE: multi-table select (not a join)
>You want to do a UNION. See:
>> -----Original Message-----
>> From: neal [mailto:nealcabage@stripped]
>> Sent: 23 September 2002 07:57
>> To: mySQL
>> Subject: multi-table select (not a join)
>> How do you select from two tables, without joining those tables?
>> I just want the results of one table slapped on the end of
>> the results from
>> another table because I don't want the overheard of running
>> two seperate
>> queries. For instance:
>> Lets say that I have these two tables (and thur values):
>> Foo Bar
>> a1 b1 a3 b3 c3
>> a2 a2 a4 b4 c4
>> I would like a table (resultset) returned something like
>> this. Of course it
>> would need an additional field to specify which table the
>> values came from:
>> a1 b1 foo
>> a2 b2 foo
>> a3 b3 c3 bar
>> a4 b4 c4 bar
>> Anyone know how to do a query like this?
> > Neal