Jump to content

Archived

This topic is now archived and is closed to further replies.

Birdofprey

Not Getting future dates?

Recommended Posts


[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?

Share this post


Link to post
Share on other sites
[!--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--]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.