gpt4 book ai didi

mysql - SQL数据库选择表时的日期格式

转载 作者:行者123 更新时间:2023-11-30 00:07:48 25 4
gpt4 key购买 nike

我需要选择 * 订单日期在 20/05/2011 和 19/05/2013 之间的表格行

我已经尝试过这个

select * from commandes where datecmd < 20-05-2011 and datecmd > 19-05-2013

它没有返回任何错误,但我想知道始终使用的最佳日期格式。

最佳答案

尝试这个 SQl 查询

SELECT * 
FROM commandes
WHERE datecmd between convert(datetime,'20-05-2011',103) and convert(datetime,'19-05-2013',103)

关于mysql - SQL数据库选择表时的日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24367010/

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