mysql合并标签和去重
select count(DISTINCT object_code) as count from object_tag where tag_name ="test2"
SELECT
a.unid,
a.entname AS "objBindName",
a.enttype,
a.enttype_cn,
a.industry_category,
a.industry_category_cn,
GROUP_CONCAT( b.tag_code SEPARATOR ',' ) AS "tagCode"
FROM
jg_company_info a
LEFT JOIN object_tag b ON a.unid = b.object_code
AND b.delete_flag = 0
WHERE
entname LIKE '%liren%'
or b.tag_name LIKE '%test2%'
GROUP BY
a.unid,
a.entname,
a.enttype,
a.enttype_cn,
a.industry_category,
a.industry_category_cn
LIMIT 0,
10
本文来自博客园,作者:ElloeStudy,转载请注明原文链接:https://www.cnblogs.com/ElloeStudy/p/17650529.html