MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Egor Egorov Date:March 3 2004 2:58pm
Subject:Re: Table selection
View as plain text  
"Marco Bresciani" <m.bresciani@stripped> wrote:
> Hello all,
>  I have a little problem to solve.
> I have a "List" table that lists the tables contained in the same DB. This
> table has a "Name" filed that contains such names.
> 
> My problem is that the list.name filed doesn't contain the complete name of
> the tables but it misses a "prestring". Say: a table is named "FXnnnn" but
> the list.name field contains "nnnn" only.
> 
> I have to create a query like:
> 
> SELECT * FROM [every table in list.name] WHERE [condition]
> 
> but I cannot use "SELECT Name FROM List" to gain the names of the tables
> because they all miss the "FX" string.
> 
> How can I create this kind of query? Something like:
> 
> SELECT * FROM ("FX" + SELECT Name FROM List) WHERE [condition]
> 

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.



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