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 @   ElloeStudy  阅读(12)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
点击右上角即可分享
微信分享提示