gpt4 book ai didi

c# - 选择mysql之间的日期

转载 作者:太空宇宙 更新时间:2023-11-03 11:47:19 25 4
gpt4 key购买 nike

我需要选择 2 个日期之间的记录,如下所示:

select pa_EntryDate , pa_Number , pa_Value , pa_Note 
from payments
where (DATE_FORMAT(pa_EntryDate, '%d/%m/%Y')
between '1/6/2016' and '12/6/2016')
and pa_To = 42
and archived=0

pa_EntryDate 列中的日期格式为:“2015-09-10 00:00:00”..

生成的结果超出了我的日期范围,有一些遗漏:

   pa_EntryDate      id      value
2015-09-10 00:00:00 1356 1031.00
2015-11-12 00:00:00 1564 1111.00
2015-12-10 00:00:00 1644 1138.00
2016-02-11 00:00:00 192 1255.00
2016-03-10 00:00:00 282 1110.00
2016-05-12 00:00:00 467 1141.00

最佳答案

转换你的日期str

select pa_EntryDate , pa_Number , pa_Value , pa_Note 
from payments
where pa_EntryDate between STR_TO_DATE('1/6/2016', '%d/%m/%Y')
and STR_TO_DATE('12/6/2016', '%d/%m/%Y')
and pa_To = 42
and archived=0;

关于c# - 选择mysql之间的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37778475/

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