MySQL Forums
Forum List  »  MySQL Query Browser

subquery generating field names for select query
Posted by: mayank madhav
Date: December 23, 2008 09:13AM

I need to supply the field names to a 'select' statement from a subquery like

select (<subquery returning the column names>) from table_name;

I want to return the dynamic list of field names fed from another query and send select query for those column names. I tried this

select (SELECT COLUMN_NAME FROM information_schema.`COLUMNS` C WHERE table_name = '<Table_Name1>') from '<Table_Name>';

I want the subquery to generate the fields on which the we can perform select operation.But it instead produces strings. Subquery returns more than one row and i am unable to assign it to the select statement.
Please tell me if there is a way to send column names from a sub query to a select statement.

Options: ReplyQuote


Subject
Written By
Posted
subquery generating field names for select query
December 23, 2008 09:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.