SELECT c.xitongshijian,sum(c.zongyeji) FROM count_report c group by c.xitongshijian;根据count_report的时间分组统计总业绩,然后根据count_report的时间再查询统计另一张表的总业绩。写完了select t1.xitongshijian,t1.zyj,t2.xf from (SELECT xitongshijian,sum(zongyeji) as zyj FROM count_report group by xitongshijian )t1 left join (select xitongshijian,sum(xiaofei) as xf from shangwutong group by xitongshijian) t2 on t1.xitongshijian=t2.xitongshijian
1 回答
蛊毒传说
TA贡献1895条经验 获得超3个赞
不是很明白,不过大致猜想你是想要 select field from tableName where field in (select field from tableName group by field )
添加回答
举报
0/150
提交
取消