赞
踩
notice表在中的relation_ids,是exception_trend表中的id 逗号分隔组成。又要根据exception_trend中的name字段模糊查询。
之前考虑的是先把exception_trend中的name模糊查询做出一个子查询,再把relation_ids任一元素 在 子查询中存在,就显示记录。查了一圈没有找到相关语句需要自己实现。
- select n.* from notice as n where n.type = 2 and
- (select group_concat(obj.name) from exception_trend as obj
- where FIND_IN_SET(obj.id,n.relation_ids)) like '%1%'
临时解决,设计还是有点问题。项目中还是少用逗号分隔。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。