请教管理员,下面的sql语句如何按时间来传递参数
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
我想在web应该用系统将字段为:开始时间、结束时间 传递给cb_birthdate,不知该如何写我的传参的语句。
[ 本帖最后由 lfmhr 于 2012-5-19 10:42 编辑 ]