sql查询一个字段包含另一个字段内容

SELECT * FROM tbl_name WHERE a like CONCAT(’%’,b,’%’);
字段a包含字段b
例如 Find the capital and the name where the capital includes the name of the country.

select capital ,name 
from world 
where capital like concat('%',name,'%')

你可能感兴趣的:(数据库)