skystar008 2021-06-18 17:12 采纳率: 0%
浏览 7

多个分类同名商品查询问题

多个类别(catid)下面存在同名商品(name),查询结果会出现约定分类以外的同名商品,帮我看下这个语句有什么问题,谢谢!

select id,catid,name from products where name in (select name from products where find_in_set(catid,'2,5') group by name having count(name)>1) order by name;

  • 写回答

3条回答 默认 最新

  • 关注

    select id,catid,name from products where catid in (find_in_set(catid,'2,5')) and name in (select name from products where find_in_set(catid,'2,5') group by name having count(name)>1) order by name;

    评论

报告相同问题?