在where子句中使用datetime作为条件 [英] use datetime as a condition in where clause

查看:686
本文介绍了在where子句中使用datetime作为条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!
我在whereClause中使用datetime,但问题是它没有显示任何结果.这是查询
从评论中选择* SendTime =''2011/4/2下午11:57:25''
sendTime是数据类型datetime的字段
而另一个也不起作用的查询是
从注释c,R中选择*,其中c.SendTime = r.SendTime

hi!
i am using datetime in whereClause but the problem is that it is not displaying any results. here is the query
select * from Comments where SendTime=''4/2/2011 11:57:25 PM''
wher sendTime is the field of datatype datetime
and an other query which is also not working is
select * from Comments c,Rating r where c.SendTime=r.SendTime

推荐答案

否,它将无法正常工作:SQL使用 ^ ]:"yyyy-MM-dd hh:mm:ss"采用24小时格式,因此您的匹配字符串将始终失败.
将您的匹配字符串转换为ISO格式,或者改用DateTime变量.
No, it won''t work: SQL uses ISO format dates[^]: "yyyy-MM-dd hh:mm:ss" in 24 hour format, so your match string will always fail.
Either convert your match string to ISO format, or use a DateTime variable instead.


这篇关于在where子句中使用datetime作为条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆