select un_name,count(*) as '出生数',
sum(case cb_childsex when '男' then 1 else 0 end) as '男',
sum(case cb_childsex when '女' then 1 else 0 end) as '女'
from
dbo.csrk_view,unitname
where 1=1
and cb_birthdate >='2009-11-01' and cb_birthdate<='2010-10-31' and hd_belongunit is not null
and hd_belongunit=un_id
and un_cityid = '469022000000'
and hd_inputday-cb_birthdate >=30
group by un_name
上面的语句中传递参数渗格式要怎么写:
and cb_birthdate >='2009-11-01' and cb_birthdate<='2010-10-31' and hd_belongunit is not null
and hd_belongunit=un_id
and un_cityid = '469022000000'
and hd_inputday-cb_birthdate >=30
-----------------------------
设计器中 sql写法:
-----------------------------
and cb_birthdate >='${beginDate}' and cb_birthdate<='${endDate}' and hd_belongunit is not null
and hd_belongunit=un_id
and un_cityid = '469022000000'
and hd_inputday-cb_birthdate >=30 作者: admin 时间: 2012-5-24 12:06