Thanks for the suggestion but this would actually create a new table,
correct (the first statement that is)?  I just want a resultset with these
values, without writing to disk.

On another note, yeah youre right not a different connection object, but I
presume I would need to run two seperate queries and recieve back two
seperate resultsets.

Neal


-----Original Message-----
From: Paul DuBois [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 9:21 AM
To: neal; mySQL
Subject: RE: multi-table select (not a join)


At 0:23 -0700 9/23/02, neal wrote:
>Oh man!
>
>Yeah, you're right.  That's exactly what I want but apparently it wasn't
>implemented until v4??!?!?!

Right.

>
>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
tmp.

>
>Thanks.
>Neal
>
>-----Original Message-----
>From: Herman Verkade [mailto:[EMAIL PROTECTED]]
>Sent: Monday, September 23, 2002 12:14 AM
>To: 'neal'
>Subject: RE: multi-table select (not a join)
>
>
>You want to do a UNION. See:
>       http://www.mysql.com/doc/en/UNION.html
>
>Regards,
>Herman Verkade
>
>
>>  -----Original Message-----
>>  From: neal [mailto:[EMAIL PROTECTED]]
>>  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?
>>
>>  Thanks.
>  > Neal


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to