求一简单SQL?
bak.A为05年上半年数据
05.A为05年下半年数据
字段完全一致
现在要求count(DJH),sum(JE)/count(DJH)?
------解决方案--------------------select count(djh) , sum(je)/count(djh) from
(
select * from 上半年数据
union all
select * from 下半年数据
) t
------解决方案--------------------select count(djh) , sum(je)/count(djh) from
(
select * from bak.A
union all
select * from 05.A) a