首先你要明确时间的起止,实际上你的时间含义是精确到秒的,虽然sql中没体现出来 我理解你要求的时间就是2006-01-01这1天24小时的数据 select count(*) from table where 疾病='水痘患者' and substr(时间,0,7)='2006-01-01' //你可以截取时间如果你需要求一段时间的话,也可以截取时间判断 比如:2006-01-01这1天24小时的数据和2006-01-02这1天24小时的数据 and (substr(时间,0,7)>='2006-01-01' and substr(时间,0,7)<='2006-01-02' ) //你可以截取时间
select count(*) from table where 疾病='水痘患者' and to_char(时间,'YYYYMMDD hh24:mi:ss') like '20060101'||'%' //你可以截取时间
我理解你要求的时间就是2006-01-01这1天24小时的数据
select count(*) from table
where 疾病='水痘患者'
and substr(时间,0,7)='2006-01-01' //你可以截取时间如果你需要求一段时间的话,也可以截取时间判断
比如:2006-01-01这1天24小时的数据和2006-01-02这1天24小时的数据
and (substr(时间,0,7)>='2006-01-01' and substr(时间,0,7)<='2006-01-02' ) //你可以截取时间
where 疾病='水痘患者'
and to_char(时间,'YYYYMMDD hh24:mi:ss') like '20060101'||'%' //你可以截取时间