gpt4 book ai didi

php - 从mysql数据库表中选择 future 日期记录

转载 作者:行者123 更新时间:2023-11-29 08:02:17 25 4
gpt4 key购买 nike

enter image description here

我的表的架构如下:

enter image description here

我有上面的表格,其中日期数据类型为“l_from”,我想选择所有具有今天日期或所有 future 日期的记录。

为此,我使用了以下查询:

SELECT emp_sno,emp_type,l_from,l_to,l_nature 
FROM leaves_history
WHERE l_from < CURDATE() AND emp_type = 1

但是上面的查询没有帮助。
我已经改变了

where l_from >= curdate()

where l_from <= curdate()

但没有子句返回突出显示的行。

我应该改变什么?

提前致谢

最佳答案

尝试一下吗?

SELECT emp_sno,emp_type, l_from, l_to, l_nature 
FROM leaves_history
WHERE l_from <= NOW() AND emp_type = 1

编辑已更改<=为>=

SELECT emp_sno,emp_type, l_from, l_to, l_nature 
FROM leaves_history
WHERE l_from >= DATE(NOW()) AND emp_type = 1

关于php - 从mysql数据库表中选择 future 日期记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23486281/

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