I am trying to find users who have had one subscription but not the other.
I am using this query to locate one of the subscription types:
SELECT username
FROM subscriptionlog
LEFT JOIN user ON (user.userid = subscriptionlog.userid)
WHERE subscriptionid = 6 AND status = 0 AND usergroupid = 2
Now out of this group I need to find ONLY the users who have NOT had subscriptionid = 1.
Basically, if there userid exists in subscriptionlog more than once (indicating more than one subscription has existed for the user) I don't want the username returned. ONLY users who have had subscriptionid 6 and NOT 1.
Any help would be greatly appreciated!
I am using this query to locate one of the subscription types:
SELECT username
FROM subscriptionlog
LEFT JOIN user ON (user.userid = subscriptionlog.userid)
WHERE subscriptionid = 6 AND status = 0 AND usergroupid = 2
Now out of this group I need to find ONLY the users who have NOT had subscriptionid = 1.
Basically, if there userid exists in subscriptionlog more than once (indicating more than one subscription has existed for the user) I don't want the username returned. ONLY users who have had subscriptionid 6 and NOT 1.
Any help would be greatly appreciated!
Comment