Jump to content


Photo

Not Getting future dates?


  • Please log in to reply
1 reply to this topic

#1 Birdofprey

Birdofprey
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 17 April 2006 - 02:25 AM


SELECT * FROM table WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= 'Date' Order By 'Date' DESC Limit 14

Hi,
I'm using this to get the most recent 30 entires, but it also gives me future entries which hasn't arrive yet. Is there a way for me to query it so that only the current date and the last 30 days are called and not the future entires?

#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 17 April 2006 - 04:05 AM

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= `Date` AND `Date` <= CURDATE() [!--sql2--][/div][!--sql3--]
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--]WHERE `Date` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY) AND `Date` <= CURDATE() [!--sql2--][/div][!--sql3--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users