| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3499 人关注过本帖, 1 人收藏
标题:[出题了]2008年9月25日
只看楼主 加入收藏
szy345
Rank: 4
来 自:江苏——南京
等 级:贵宾
威 望:14
帖 子:336
专家分:14
注 册:2008-8-6
收藏
得分:0 
select num1+num2 as num ,a.type
 from  
(select sum(num1)as num1,type  from t2  
where t2.date >'2008-2-2'and t2.date <'2008-3-4'
group by type) as a
join
(select sum(num2)as num2,type  from t3  
where t3.date >'2008-2-2'and t3.date <'2008-3-4'
group by type )as b
on a.type=b.type

*************
num  type
65   in
88   out
*************

select num1+num2 as num ,a.type
 from  
(select sum(num1)as num1,type  from t2  
where t2.date >'2008-3-4'and t2.date <'2008-11-02'
group by type) as a
join
(select sum(num2)as num2,type  from t3  
where t3.date >'2008-3-4'and t3.date <'2008-11-02'
group by type )as b
on a.type=b.type


*************
num  type
122   in
21   out
*************

VFP技术交流,QQ群:20452307
欢迎您!
2008-09-26 14:20
西风独自凉
Rank: 8Rank: 8
等 级:贵宾
威 望:43
帖 子:3380
专家分:28
注 册:2007-8-2
收藏
得分:0 
select a.*,
numin=(select sum(num1)  from table2 where sdate between  (select top 1  sdate from table1 where sdate <a.sdate order by sdate desc ) and  a.sdate  group by type having type ='in' )
+ (select sum(num2)  from table3 where sdate between   (select top 1  sdate from table1 where sdate <a.sdate order by sdate desc ) and  a.sdate   group by type having type ='in' ),
numout=(select sum(num1)  from table2 where sdate between  (select top 1  sdate from table1 where sdate <a.sdate order by sdate desc ) and  a.sdate  group by type having type ='out' )
+ (select sum(num2)  from table3 where sdate between   (select top 1  sdate from table1 where sdate <a.sdate order by sdate desc ) and  a.sdate   group by type having type ='out' )
 from Table1 a     這句搞定

2008-09-26 14:23
西风独自凉
Rank: 8Rank: 8
等 级:贵宾
威 望:43
帖 子:3380
专家分:28
注 册:2007-8-2
收藏
得分:0 
回复 11# szy345 的帖子
這樣日期被你寫死了﹐有很多數據怎么辦

2008-09-26 14:24
球球
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:1146
专家分:265
注 册:2005-11-28
收藏
得分:0 
总有一天,我得把你面纱给揭了。

好累
2008-09-26 14:33
西风独自凉
Rank: 8Rank: 8
等 级:贵宾
威 望:43
帖 子:3380
专家分:28
注 册:2007-8-2
收藏
得分:0 
﹖﹖﹖﹖﹖ 說我

2008-09-26 14:42
球球
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:1146
专家分:265
注 册:2005-11-28
收藏
得分:0 
说妃子

好累
2008-09-26 14:42
szy345
Rank: 4
来 自:江苏——南京
等 级:贵宾
威 望:14
帖 子:336
专家分:14
注 册:2008-8-6
收藏
得分:0 

VFP技术交流,QQ群:20452307
欢迎您!
2008-09-26 14:47
师妃暄
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:805
专家分:107
注 册:2006-3-1
收藏
得分:0 
西风版主来了就别跑了..你可以了上任

有实力才会有魅力 实力来自坚持不懈的努力
2008-09-26 14:50
西风独自凉
Rank: 8Rank: 8
等 级:贵宾
威 望:43
帖 子:3380
专家分:28
注 册:2007-8-2
收藏
得分:0 
干嘛

2008-09-26 14:52
网易
Rank: 1
来 自:金星
等 级:禁止访问
帖 子:193
专家分:0
注 册:2008-6-10
收藏
得分:0 
那个头像的确挺漂亮的

答案是:雨中飞燕!
2008-09-26 16:44
快速回复:[出题了]2008年9月25日
数据加载中...
 
   



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

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