在线急救 日期问题!!!!
我在server 2000
查询分析器中 要查找一张表中 7月到8月 出现的数据
表中日期的格式是‘yyyy-mm-dd’
7月到八月 要怎么表达啊
谢谢了啊
问题点数:20、回复次数:5Top
1 楼wangdehao(找找找(现在很幸福))回复于 2005-12-22 19:28:58 得分 0
select * from tb where month(时间字段)=7
union all
select * from tb where month(时间字段)=8Top
2 楼dutguoyi(新鲜鱼排)回复于 2005-12-22 19:57:37 得分 0
select * from tb where month(时间字段) in (7,8)
Top
3 楼china_cn()回复于 2005-12-22 20:26:38 得分 0
select * from tb where month(时间字段) in (7,8)
谢谢了
不过我还要加上年份 如 2006-07-01 到 2006-07-08-31
要怎么表达啊Top
4 楼wangtiecheng(不知不为过,不学就是错!)回复于 2005-12-22 21:16:44 得分 0
select * from tb
where month(时间字段) in (7,8) and year(时间字段) in (2006,2007)Top
5 楼zfl2k(风)回复于 2005-12-22 21:16:44 得分 20
select * from tb where month(时间字段) in (7,8) and year(时间字段)=2006
或者干脆这样:
select * from tb where 时间字段 between '2006-7-1' and '2006-8-31'Top




