select sql data order by date

后端 未结 3 1795
我寻月下人不归
我寻月下人不归 2021-01-26 17:09

I have a table with a column called date, as a varchar. The contents are specifically formatted like \'March 11, 2011\'.

How can I select the results have

3条回答
  •  借酒劲吻你
    2021-01-26 17:17

    Yes, you can use the DATE function along with CURDATE.

    SELECT * FROM tbl WHERE DATE(your_date_column) = CURDATE()
    

    This will select all rows where your_date_column is todays date.

    If you want to select all rows where your_date_column is between two dates, you can simply use BETWEEN:

    SELET * FROM tbl WHERE your_date_column BETWEEN '20111-03-20' AND '2011-03-30'
    

提交回复
热议问题