解决方案 »

  1.   

    select
    mt.merchant_id,mb.name as merchant_name,sum(mt.price*mt.buycount) as total,date_format(mt.regdate,'%Y-%m') as regdate
    from sys_cart mt,sys_merchant mb
    where mt.payflag!=0 
    and mt.merchant_id=1 
    and DATE_FORMAT(mt.regdate,'%Y')='2014'
    group by date_format(mt.regdate,'%Y-%m')mb表没有关联,难道所有的merchant_name都指向一个name。
    不要group by看下你的数据。
      

  2.   

    跟group by没有关系,我看过了
      

  3.   

    你这边两表关联,明显连接问题你都没处理好
    sys_cart mt,sys_merchant mb这两表的关联字段都没有,就会全连接
      

  4.   

    支持3楼,两表的关联明显没处理好。
    sys_cart mt,sys_merchant mb这两表的关联字段都没有,就会全连接