ricky_vancouver Posted December 13, 2010 Share Posted December 13, 2010 hey everyone, I'm having trouble using the having clause... here's my situation: I have a table of users, and the date they joined... I want data of the users who signed up in the last 7 days before the last user signup... so my sql statement looks something like this: SELECT * from userlist HAVING created_date <= max(created_date) and created_date >= (max(created_date) - (7 * 24 * 60 * 60)) it either returns everything in the table, or nothing... have be head over heels... thanks for your help... Link to comment https://forums.phpfreaks.com/topic/221472-problem-with-having-clause/ Share on other sites More sharing options...
Adam Posted December 15, 2010 Share Posted December 15, 2010 Use GROUP BY on a unique column in the table.. (...) GROUP BY col_name HAVING (...) Link to comment https://forums.phpfreaks.com/topic/221472-problem-with-having-clause/#findComment-1147768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.