I'm trying to find members who have not made a payment for 30 days and are still on the upgraded Silver or Gold subscription. However, I'm getting an error with the following query, "Invalid use of group function". Any clues would be appreciated!


select uID from payments where (DATE_SUB(CURDATE(),INTERVAL 30 DAY) >= max(payDate)) and uID in (select uID from users where subscription <> 'Free');