satto [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 31, 2007 11:56 AM
To: mysql@lists.mysql.com
Subject: Re: Finding a value in multiple tables
On Tue, July 31, 2007 8:52, David Ruggles said:
> I need to find a userid across several different tables.
>
> What is the best way to do this?
>
> I want to find the value 123 in the field "id" in any one of these
tables.
SELECT id FROM TableA WHERE id = 123
UNION
SELECT id FROM TableB WHERE id = 123
UNION
SELECT id FROM TableC WHERE id = 123
Please note that UNION requires that the same number (and type?) of
fields be selected from each
On Tue, July 31, 2007 8:52, David Ruggles said:
> I need to find a userid across several different tables.
>
> What is the best way to do this?
>
> For example I have three tables
> TableA
> TableB
> TableC
>
> They all have a field "id"
>
> I want to find the value 123 in the field "id" in any one