---- 已经绑定终端
SELECT DISTINCT t.`pkCode` ,t.* FROM TbTerminal t,
(SELECT
g.`sTers` AS city
FROM
TbTerGroup g
WHERE g.`sTers` IS NOT NULL) A
WHERE FIND_IN_SET(t.pkCode,city)
----未绑定
SELECT DISTINCT t.`pkCode` ,t.* FROM TbTerminal t,
(SELECT
g.`sTers` AS city
FROM
TbTerGroup g
WHERE g.`sTers` IS NOT NULL) A
WHERE FIND_IN_SET(t.pkCode,city)
如下图,需求:code 只要包含city在city里面就显示
----模糊查询
SELECT
*
FROM
TbTerGroup g,
(SELECT
t.`pkCode` AS city
FROM
TbTerminal t) A
WHERE g.`sTers` LIKE CONCAT('%', city, '%')
AND g.`sTers` IS NOT NULL