The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
SQL query to check payed up members
Hi,
Can anyone advise what sql query would identify all users who are in a 'Members' usergroup who do not have a current 'Active' subscription? Thanks Vince |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
Cheers Marco, that seems to work!
Is this only telling me everyone who has an expired subscription who is still a in Member usergroup? Does it also tell me people in Member usergroup who have no subscription information active or expired? Cheers |
#4
|
|||
|
|||
This should be listing everyone in usergroup = 2 (not taking secondary usergroups into consideration) and have no active subscription (no subscription or only an expired subscription). But as i don't have good real data to test i am not 100% sure.
|
#5
|
|||
|
|||
Great, yes i thought so after re reading it.
Works perfect cheers |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|