Crustyfur Posted December 9, 2009 Share Posted December 9, 2009 ello, I am struggling with date functions as always and need some help. I just want to show results from the last 30 days. Thanks in advance. C SELECT COUNT(a.id), a.productid, p.productid, p.producttitle, p.productcode, p.manfid, m.manfid, m.manufacturer, DATE_FORMAT(a.datetime, '%D %M %Y') as a.datetime FROM tt_gear_afflinks_data a, tt_gear_product p, tt_gear_manufacturer m WHERE a.productid = p.productid AND p.manfid = m.manfid AND a.datetime = CURDATE() >= 30 GROUP BY a.productid ORDER BY COUNT(a.id) DESC LIMIT 20 Link to comment https://forums.phpfreaks.com/topic/184520-showing-records-from-previous-30-days/ Share on other sites More sharing options...
JustLikeIcarus Posted December 9, 2009 Share Posted December 9, 2009 An example that gives you the last 30 days. SELECT something FROM tbl_name WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col; Link to comment https://forums.phpfreaks.com/topic/184520-showing-records-from-previous-30-days/#findComment-974143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.