读书人

求一句日期查找型sql句解决办法

发布时间: 2012-02-12 17:16:33 作者: rapoo

求一句日期查找型sql句

SQL code
    A                               B           2007-10-18 上午 11:20:22           thems2007-10-16 上午 11:20:23           thems2007-10-17 上午 11:20:24           thems2007-10-18 上午 11:20:26           thems

我想要得到 2007-10-18全天的怎?
大或小於2007-10-18全天的呢?
我使用Convert只能 2007-10-18 00:00:00 的格式
不能比查找


[解决办法]

select * from t where convert(varchar(10),date1,120)='2007-10-18'
[解决办法]
SQL code
select * from tb where convert(varchar(10),字段,120) = '2007-10-18'
[解决办法]
SQL code
等于:select * from 表名 where convert(varchar(10),A,120) = '2007-10-18'大于:select * from 表名 where convert(varchar(10),A,120) > '2007-10-18'小于:select * from 表名 where convert(varchar(10),A,120) < '2007-10-18' 

读书人网 >SQL Server

热点推荐