MySQL-如何在列名称本身中使用WHERE子句中的通配符?
问题描述:
我有一个关于mysql的基本问题.在我的表表"中,我有一列名为"foo"(字符串).我想做这样的事情:
I've got a basic question about mysql. In my table 'table' I've got a column named 'foo' (String). And I'd like to do something like this:
SELECT * FROM table WHERE %foo% LIKE '%thing%'
但这显然是不正确的.提前致谢.
But it's obviously incorrect. Thanks in advance.
答
SELECT * FROM table WHERE key like '%sth%'