作者koehie (开喜乌龙茶)
看板Database
标题Re: [SQL ] 合并资料表
时间Thu Oct 20 18:34:47 2011
/
select a.a, a.b, a.c, b.b, b.c, c.b, c.c
from
(select year a, count(id) b, sum(amea) c
from t1
group by year) a,
(select year a, count(id) b, sum(amea) c
from t2
group by year) b,
(select year a, count(id) b, sum(amea) c
from t3
group by year) c
where a.a = b.a(+) and b.a = c.a(+)
order by to_number(a.a) desc
/
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.233.168.82
1F:推 insert:试过修改後已可用 谢谢:-) 10/21 10:11