select * from u_codeid,codeid_log having u_codeid.u_codeid=codeid_log.codeid and count(codeid_log.codeid)<=10 and codeid_log.fs='消费' group by codeid_log.codeid ) order by u_codeid.u_id desc
group by 出错!

解决方案 »

  1.   

    楼主从哪学的SQL语法?select 
        codeid_log.codeid 
    from 
        u_codeid,codeid_log 
    where
        u_codeid.u_codeid=codeid_log.codeid 
        and 
        codeid_log.fs='消费' 
    group by 
        codeid_log.codeid 
    having 
        count(codeid_log.codeid) <=10
    order by 
        codeid_log.codeid 
      

  2.   

    select语法顺序select from wheregroup by having order by 
      

  3.   


    select   codeid_log.codeid    
    from     u_codeid,codeid_log  
    where    u_codeid.u_codeid=codeid_log.codeid 
    and      codeid_log.fs='消费'   
    group   by   codeid_log.codeid 
    having   count(codeid_log.codeid) <=10  order   by   u_codeid.u_id   desc 
      

  4.   

    group by ...having ...order by ...
      

  5.   

    o ,不是说多表查询中的条件05不用AND吗?我不知道是否记错了,我去试下