直接通过写一条复杂的SQL语句来解决性能会最优。SQL版的牛人一大堆。
解决方案 »
- ╭︿︿︿╮ {/ o o /} ( (oo) ) ︶ ︶︶ ╭︿︿在线急等,110,119,911,救命啊,我快疯了,110,110 ??? 《》关于获取网页源文件的问题,《》
- 高分请教关于笔记本无线上网的问题,知道的麻烦进来看下..............................
- 定制dropdownlist样式???
- ListBox多选总是显示第一个选项????
- DATAGRID中多表头问题 看了一些多表头制作。太笨!没明白 求助
- group by 问题 急~~~~
- 数据库记录如果有几千条,用dataset作为数据源性能高吗?
- context这个类型,在什么地方定义才算是全局变量呢?在global.asax中?
- VS2005,添加现有项问题
- 简单问题!!!!!!!40分送上!
- 获取远程用户的IP和主机名
- 页面传值并判断
as
SELECT distinct gzdw,(select count(*)
from person as A
where (datediff(day,csny,getdate())/365)<=30
and A.gzdw=B.gzdw) as ssyx,(select count(*)
from person as A
where 31<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=35
and A.gzdw=B.gzdw) as sydsw,
(select count(*)
from person as A
where 36<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=40
and A.gzdw=B.gzdw) as sldsl,
(select count(*)
from person as A
where 41<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=45
and A.gzdw=B.gzdw) as sydsws,
(select count(*)
from person as A
where 46<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=50
and A.gzdw=B.gzdw) as sldwl,
(select count(*)
from person as A
where 51<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=55
and A.gzdw=B.gzdw) as wydww,
(select count(*)
from person as A
where 56<=(datediff(day,csny,getdate())/365) and (datediff(day,csny,getdate())/365)<=60
and A.gzdw=B.gzdw) as wldll,(select avg(datediff(day,csny,getdate())/365)
from person as A
where A.gzdw=B.gzdw) as pjnl