like concat('%',字段,'%')
SELECT count(1) , a.fd_name FROM `wj_replay` r ,
(select fd_name,fd_id FROM sys_org_element WHERE
fd_parentid = '12f57b369d752287395ec7244e889f95' and fd_org_type =2 ) a where
r.fd_hierarchy_id LIKE concat('%',a.fd_id,'%') and r.oid = 22 group by a.fd_id

本文介绍了一种使用SQL进行复杂查询的方法,特别是如何通过连接多个表并使用LIKE与concat函数来筛选特定的数据记录。此方法适用于从大型数据库中抽取与指定条件相符的数据。

488

被折叠的 条评论
为什么被折叠?



