标题:关于结果集联接的问题
只看楼主
zhanglisuo
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-1-1
 问题点数:0 回复次数:1 
关于结果集联接的问题

各位高手,我有一张表存储大量信息,我现在想要以下两段代码所列出的结果集合并在一起,请问应该怎样写

select sj as sj,sum(sfy) as sfl
from dat_bdxx
where xtrq>='2007.03.01' and jclx='D'
group by sj,dic_sjbm.xm
order by sfl

select fsj as sj,sum(sfy) as sfl
from dat_bdxx,dic_sjbm
where xtrq>='2007.03.01' and jclx='N'
group by fsj,dic_sjbm.xm
order by sfl


搜索更多相关主题的帖子: 联接 结果 
2007-04-10 16:48
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
得分:0 

select sj as sj,sum(sfy) as sfl
from dat_bdxx
where xtrq>='2007.03.01' and jclx='D'
group by sj,dic_sjbm.xm
order by sfl

Union

select fsj as sj,sum(sfy) as sfl
from dat_bdxx,dic_sjbm
where xtrq>='2007.03.01' and jclx='N'
group by fsj,dic_sjbm.xm
order by sfl


2007-04-10 17:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-130789-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.230588 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved