Navigation

    GitHub中文社区
    • GitHub排行榜

    论坛

    • Login
    • Categories
    • Recent
    • Tags
    • Popular

    mysql timestamp时间范围查询+模糊匹配问题求助!!!

    技术交流
    2
    2
    122
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • whySoSerious-tcc
      whySoSerious-tcc last edited by whySoSerious-tcc

      76fdf917-27f2-4786-a9b1-0fcb6159e4ba-image.png
      表如上图所示。

      SELECT * FROM 
      	vehicle_warning_message v 
      	WHERE 
      	v.capture_time >= "2023-10-03%" 
      	AND v.capture_time <= "2023-11-03%"
      

      此sql查询结果为:
      c23e2d68-a242-40b4-afd5-2728579b205e-image.png
      为啥可以显示出2023-11-03日的值,显示不出来2023-10-03日的值,两个日期的值都是当天的最大时间,即"2023-10-03 23:59:59"和“2023-11-03 23:59:59”

      1 Reply Last reply Reply Quote 0
      • mango
        mango last edited by

        都没用LIKE,这那里是模糊匹配。你是把时间转成字符串,当字符串比较了。

        1 Reply Last reply Reply Quote 0
        • First post
          Last post