MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Egor Egorov Date:March 3 2004 3:52pm
Subject:Re: Table selection
View as plain text  
"Marco Bresciani" <m.bresciani@stripped> wrote:
> Egor Egorov <egor.egorov@stripped> ha scritto:
> 
>>You can't do it only with MySQL. Retrieve table names from List table:
>>       SELECT CONCAT("FX", Name) FROM List;
>>
>>and then use programming language to construct a query.
> 
> Thank you... I've supposed it...
> What about using UNION? Something like:
> 
> SELECT * FROM FX5686 UNION SELECT * FROM FX5698 UNION ... WHERE [condition]
> 
> I obviously need a programming language to compose this query... but it
> seems clearer to me... if it works!

You can use UNION, but WHERE condition should be written for each SELECT in the UNION:
	(SELECT * FROM FX5686 WHERE ..) UNION (SELECT * FROM FX5698 WHERE .. ) ..



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   Egor.Egorov@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



Thread
Table selectionMarco Bresciani3 Mar
  • Re: Table selectionEgor Egorov3 Mar
  • Re: Table selectionMarco Bresciani3 Mar
    • Re: Table selectionEgor Egorov3 Mar