【问题标题】:How to select data from mysql database by date [closed]如何按日期从mysql数据库中选择数据[关闭]
【发布时间】:2018-05-23 20:14:10
【问题描述】:

我有一个 DB 表,其中有一个列约会日期 [type: date],我想选择与今天日期匹配的所有数据。

【问题讨论】:

    标签: php mysql sql database date


    【解决方案1】:

    MS SQL 服务器

    使用 CURRENT_TIMESTAMP 函数

    select * from dates where appointment_date = CAST(CURRENT_TIMESTAMP AS DATE);

    MYSQL

    select * from dates where appointment_date = cast(now() as date);

    【讨论】:

    • 我已经尝试过上面的代码,但它不起作用。您还有其他建议吗?
    • 你用的是什么数据库?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-13
    • 2011-12-04
    相关资源
    最近更新 更多