现有2个查询,需要将每个查询的结果合并起来(注意不是合并结果集,因此不能使用union),可以将每个查询的结果作为临时表,然后再从临时表中select所需的列,示例如下:
SELECT get.daytime, get.data as get, xh.data as xh FROM ( SELECT daytime, sum(get_sum) as data FROM yuanbao_get group by daytime order by daytime ) as get, ( SELECT daytime, sum(xh_sum) as data FROM yuanbao_xh group by daytime order by daytime ) as xh where get.daytime = xh.daytime