2011-06-03 204 views

回答

3

据我所知,你不能。您将不得不手动指定它们。

(见式两份)

1

您的SELECT指定他们,但你可以通过做选择的列清单(然后只能在dynamic SQL使用):

select column_name from information_schema.columns 
        where table_schema = database() 
         and table_name = 'mytesttable' 
         and column_name like 'icon_%' 
0
set @qry = (select concat('select ',group_concat(column_name), ' from ' ,table_name) from 
information_schema.columns 
where table_schema = database() 
and table_name = 'your_table_name' 
and column_name like 'icon_%'); 

prepare stmt from @qry; 
execute stmt; 
deallocate prepare stmt;