gpt4 book ai didi

sql - 在 MS-Access 中比较日期时数据类型不匹配

转载 作者:行者123 更新时间:2023-12-04 15:59:53 24 4
gpt4 key购买 nike

我将日期以“常规日期”格式存储在 MS-Access 表中。

我正在尝试创建一个查询,该查询返回特定日期范围(2010 年 3 月以来的所有记录)之间的记录,但是我遇到了“标准表达式中的数据类型不匹配”消息。

这是我的陈述;

SELECT Loan.loan_datetimeLeant, product_name, 
[product_artist/director], product_category, loanItem_cost

FROM Loan
INNER JOIN ((Product
INNER JOIN Ite
ON Product.[product_id] = Item.[product_id])
INNER JOIN Loan_Items
ON Item.[item_id] = Loan_Items.[item_id])
ON (Loan.[cust_id] = Loan_Items.[cust_id])
AND (Loan.[loan_datetimeLeant] = Loan_Items.[loan_datetimeLeant])

WHERE Loan.loan_datetimeLeant >= '01/03/2010'
AND Loan.loan_datetimeLeant <= '31/03/2010'

ORDER BY Loan.loan_datetimeLeant;

我尝试了日期格式的变体 (mm/dd/yyyy, dd/mm/yyyy 00:00:00)

最佳答案

Access 日期的分隔符是#:

WHERE Loan.loan_datetimeLeant >= #03/01/2010# AND Loan.loan_datetimeLeant <= #03/31/2010#

关于sql - 在 MS-Access 中比较日期时数据类型不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2805121/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com