How to show 7 days of info consistently in SQL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • triathlontim

    #1

    How to show 7 days of info consistently in SQL?

    I need to consistently show seven days of info from my database. I have script that seemed to work great until the end of the month came. I am using the Date(NOW()) function to get today, and DATE(NOW())+1 to get tomorrow and so on up to +6.

    However, I guess DATE(NOW()) looks for 2010-10-32 instead of 2010-11-01. What do I have to tweak for it to work over the change of the month?

    Code:
    SELECT database.A, database.B, database.C, database.D
    FROM database
    WHERE database.A = (DATE(NOW())+1)
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    You can use ADDDATE() or DATE_ADD(). For proper syntax please refer to MySQL Date and Time Functions

    Comment

    Working...