gpt4 book ai didi

mysql - 根据日期从数据库中选择行

转载 作者:可可西里 更新时间:2023-11-01 07:23:33 26 4
gpt4 key购买 nike

我在 mysql 表中有一个行列表

+--------+-----+------------+------------+------------+-----------+| off_id | uid | leave_from | leave_to   | leave_code | reason    |+--------+-----+------------+------------+------------+-----------+|      1 |   1 | 2012-01-01 | 2012-01-05 | OFF        | asdsda    ||      2 |   1 | 2012-01-15 | 2012-01-16 | OFF        | asdd      ||      5 |   1 | 2012-02-03 | 2012-02-05 | OFF        | gfjghjhgj |+--------+-----+------------+------------+------------+-----------+

我必须选择日期 2012-01-01 到 2012-01-05 之间的行。我该怎么做,请帮忙。

最佳答案

SELECT * 
FROM tbl
WHERE leave_from >= '2012-01-01'
AND leave_to <= '2012-01-05'

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

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