本帖最后由 tudou 于 2016-3-2 17:58 编辑 查询结果1 SELECT bm, MONTH (rq) AS yf, YEAR (rq) AS nd, SUM (gs) AS glgs FROM working_hour_detail WHERE bh = '001' or bh='002' GROUP BY rq, bm 查询结果2 SELECT bm, MONTH (rq) AS yf, YEAR (rq) AS nd, SUM (gs) AS xmgs FROM working_hour_detail WHERE bh <> '001' and bh<>'002' GROUP BY rq, 需要将两个结果生成 结果1.bm, 结果1.nd, 结果1 .yf, 结果1.glgs, 结果2.xmgs 结果1和结果2中的bm不完全相同 如何写语句?在表中体现如下,我用两个查询语句,放在1个表中,项目工时按部门、年度、月份过滤求和,生成报表太慢了 |