Select records from today, this week, this month php mysql

前端 未结 11 842
粉色の甜心
粉色の甜心 2020-12-12 10:50

I imagine this is pretty simple, but can\'t figure it out. I\'m trying to make a few pages - one which will contain results selected from my mysql db\'s table for today, thi

11条回答
  •  無奈伤痛
    2020-12-12 11:08

    Everybody seems to refer to date being a column in the table.
    I dont think this is good practice. The word date might just be a keyword in some coding language (maybe Oracle) so please change the columnname date to maybe JDate.
    So will the following work better:

    SELECT * FROM jokes WHERE JDate >= CURRENT_DATE() ORDER BY JScore DESC;
    

    So we have a table called Jokes with columns JScore and JDate.

提交回复
热议问题