[英]SQL Access 2010 querying by date “Data type mismatch in criteria expression.”
I'm trying to make a query in Access 2010, but it keeps giving me this error "Data type mismatch in criteria expression." 我正在尝试在Access 2010中进行查询,但它一直给我这个错误“条件表达式中的数据类型不匹配”。
The query is simple as 查询很简单
SELECT *
FROM mytable
WHERE date = '23-07-2013'
Any wonder why? 不知道为什么?
SELECT *
FROM mytable
WHERE date = #7/23/2013#
Access enclosed a date with # signs to indicate a literal value of date. Access用#符号括起日期以指示日期的文字值。 And using a single quote in your case means you are comparing a String/Text with a Date data type thus the Data Type mismatch. 在您的情况下使用单引号意味着您正在比较字符串/文本与日期数据类型,因此数据类型不匹配。 It should therefore be: 因此应该是:
SELECT *
FROM mytable
WHERE date = #23/07/2013#
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.