Tur*_*ile 17
答案是"使用LIKE".
请参阅文档:https://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html
你可以做 WHERE 'string' LIKE CONCAT(column , '%')
因此查询变为:
select * from t1 where 'ABCDEFG' LIKE CONCAT(column1,'%');
Run Code Online (Sandbox Code Playgroud)
如果您需要匹配字符串中的任何位置:
select * from t1 where 'ABCDEFG' LIKE CONCAT('%',column1,'%');
Run Code Online (Sandbox Code Playgroud)
在这里你可以看到它在一个小提琴:http://sqlfiddle.com/#!9 / d1596/4