Birdofprey Posted April 17, 2006 Share Posted April 17, 2006 [code] SELECT * FROM table WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= 'Date' Order By 'Date' DESC Limit 14[/code]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? Link to comment https://forums.phpfreaks.com/topic/7571-not-getting-future-dates/ Share on other sites More sharing options...
shoz Posted April 17, 2006 Share Posted April 17, 2006 [!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][color=green]WHERE[/color] DATE_SUB(CURDATE(), INTERVAL 30 DAY) [color=orange]<[/color][color=orange]=[/color] `Date` [color=blue]AND[/color] `Date` [color=orange]<[/color][color=orange]=[/color] CURDATE() [!--sql2--][/div][!--sql3--][!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][color=green]WHERE[/color] `Date` [color=orange]>[/color][color=orange]=[/color] DATE_SUB(CURDATE(), INTERVAL 30 DAY) [color=blue]AND[/color] `Date` [color=orange]<[/color][color=orange]=[/color] CURDATE() [!--sql2--][/div][!--sql3--] Link to comment https://forums.phpfreaks.com/topic/7571-not-getting-future-dates/#findComment-27610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.