我想在oracle存储过程中实现:
1.查询出各类的总数
sortname total color
aa 100 1
bb 200 2
cc 220 3
dd 260 8
2.然后再查询出各类增加的数目
sortname add date
aa 10 ...
bb 20 ...
cc 30 ...
dd 40 ...
我如何把下面查询的add字段合并到上面去啊?
使之成为:
sortname total color add
aa 100 1 10
bb 200 2 20
cc 220 3 30
dd 260 8 40
谢谢各位帮助!
1.查询出各类的总数
sortname total color
aa 100 1
bb 200 2
cc 220 3
dd 260 8
2.然后再查询出各类增加的数目
sortname add date
aa 10 ...
bb 20 ...
cc 30 ...
dd 40 ...
我如何把下面查询的add字段合并到上面去啊?
使之成为:
sortname total color add
aa 100 1 10
bb 200 2 20
cc 220 3 30
dd 260 8 40
谢谢各位帮助!
from (查询1) a,(查询2) b
where a.sortname = b.sortname;
from (
select sortname,total,color
from ...
) A,
(
select sortname,add,date
from ...
) B
where A.sortname=B.sortname
from t1 a,t2 b
where a.sortname=b.sortname