SELECT c.xitongshijian,sum(c.zongyeji) FROM count_report c group by c.xitongshijian;根據(jù)count_report的時(shí)間分組統(tǒng)計(jì)總業(yè)績(jī),然后根據(jù)count_report的時(shí)間再查詢(xún)統(tǒng)計(jì)另一張表的總業(yè)績(jī)。寫(xiě)完了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 回答

蠱毒傳說(shuō)
TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超3個(gè)贊
不是很明白,不過(guò)大致猜想你是想要 select field from tableName where field in (select field from tableName group by field )
添加回答
舉報(bào)
0/150
提交
取消