select * from tt a where 2>=(select count(*) from tt where a.title=title)

解决方案 »

  1.   

    select * from tt a where 2>=(select count(*) from tt where a.title=title
    and a.userid=userid
    )
      

  2.   

    句法解释:
    char_length( title) #获得字符串长度
    replace( title, “vip保过版” ) #将字符串中的A替换为空
    char_length( title) – char_length( replace( title, “vip保过版”, ” ) ) #计算得到差就是被替换的字符串的个数
    select char_length( title) – char_length( replace( title, “vip保过版”, ” ) ) from tt a where 1  group by  userid 
    但每次只能查询一个....
      

  3.   

    版主 我用你给我提供的语句select userid,title,group_concat(distinct oid)  from `djs_shops_products` a where 2>=(select count(*) from `djs_shops_products` where a.title=title) group by(userid)
    查询结果
    并不是我想要的啊
      

  4.   

    版主
    select  userid,group_concat(distinct title),group_concat(distinct oid)  from `djs_shops_products` a where 2>=(select count(*) from `djs_shops_products` where a.title=title and a.userid=userid)group by userid;
    我有这么修改了一下,但是结果导致他的>=的条件判断好像失败了
      

  5.   

    select * from tt a where 2>=(select count(*) from tt where a.title=title)
    直接运行,不加入group_concat,结果是什么