一个天气预报的SQL语句,郁闷中 getdate()-1这什么意思,日期加减法用dateadd()函数 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 --依照date字段,要求大于2006-12-19 17而且小于2006-12-20 16:00--trywhere weather.date>'2006-12-19 17:00:00' and weather.date<'2006-12-20 16:00:00' 不太了解楼主的意思:)create table weather(ID int identity(1,1), weather varchar(10), city varchar(10), max_tem int, min_tem int, date1 datetime)insert weatherselect '晴','北京',8,2,'2006-12-19 16:31:06' union allselect '晴','北京',8,2,'2006-12-19 17:00:00' union allselect '晴','北京',8,2,'2006-12-20 16:00:00'select * from weather where date1 between '2006-12-19 17:00' and '2006-12-20 16:00'--结果:7 晴 北京 8 2 2006-12-19 17:00:00.0008 晴 北京 8 2 2006-12-20 16:00:00.000呵呵,符合条件咯 连接sql2008的问题? 求一个查询,显示类别都存在的款。 请问:如何在sql中设置,如果不符合条件,将不能保存记录? 如何备份数据库?谢谢!(从别的机器备份到本机) 怎样更新结果集? 两个相同结果集求差值问题 一个复杂的查询问题 一个字符串的排序问题,在线等! 请教,在用powerdesigner建模时,怎么设置该日期列自动取得系统当前日期 请问为什么有的windows2k能装mssql,而有的只能装mssql的客户端? SQL里变量如何与表结合? SQL Server故障,请高手赐教
--try
where weather.date>'2006-12-19 17:00:00' and weather.date<'2006-12-20 16:00:00'
create table weather(ID int identity(1,1),
weather varchar(10),
city varchar(10),
max_tem int,
min_tem int,
date1 datetime
)
insert weather
select '晴','北京',8,2,'2006-12-19 16:31:06' union all
select '晴','北京',8,2,'2006-12-19 17:00:00' union all
select '晴','北京',8,2,'2006-12-20 16:00:00'select * from weather
where date1 between '2006-12-19 17:00' and '2006-12-20 16:00'--结果:
7 晴 北京 8 2 2006-12-19 17:00:00.000
8 晴 北京 8 2 2006-12-20 16:00:00.000
呵呵,符合条件咯