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
posted @ 2023-08-23 10:23  ElloeStudy  阅读(8)  评论(0编辑  收藏  举报