Reputation: 8518
I have a Table 'Notification_details' where I query to obtain the unique records with the following MySQL query
select userid, max(notification_date) as notification_date from notification_details group by userid order by notification_date asc
Which gives the result, where the userid is unique and the notification_date is the latest( max). Now, I would like to extend the MySQL command to query between 2 dates of the result I have obtained :
Any idea, how to extend the above MySQL command ?
Upvotes: 3
Views: 119
Reputation: 11578
If I didn't missunderstand you:
SELECT alias.*
FROM (select userid, max(notification_date) as notification_date from notification_details group by userid order by notification_date asc) alias
WHERE alias.notification_date BETWEEN DATE1 AND DATE2
Upvotes: 3