Try the following query:
[sql]SELECT u.userid, COUNT(sl.userid) AS subscriptioncount
FROM USER AS u
LEFT JOIN subscriptionlog AS sl ON (u.userid = sl.userid AND sl.status = 1)
WHERE u.usergroupid = 2
GROUP BY u.userid
HAVING subscriptioncount = 0
[/sql]
You will need to replace the usergroupid with the id of the usergroup you are looking for.
I could not test the status field as i don't have any active subscriptions on my testforum, so i am assuming that status = 1 means it is active. You might want to check that in your database first.
|