我有一张这样的 table :
id exemple_ABC tr_ABC exemple_BCD tr_BCD ....
我想选择以“exemple_”开头的所有列 我试试:
SELECT exemple_* FROM myTable
or
SELECT exemple_% FROM myTable
但这一切都行不通......
最佳答案
您不能使用标准 SQL。在 SQL 中,列名不被视为数据。
如果您使用的 SQL 引擎具有存储列名、类型等的元数据表,您可以改为在该表上进行选择。
试试这个
select * from information_schema.columns
where table_name='table1' and column_name like 'exemple_%'
关于mysql - sql : select some column which I don't know the entire name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24306627/