View Full Version : style stat mod?
Sculli
12-06-2005, 06:25 AM
So I am a noob at mysql queries, is there an easy way to establish which style users are using? I'd like output along the lines of:
style01 283 users
style02 281 users
style03 193 users
...
I tried search, but as always, if not quite sure what one is looking for the hits are overwhelmingly irrelevant.
Marco van Herwaarden
12-06-2005, 06:50 AM
Not tested:
SELECT styleid, COUNT(*) FROM user GROUP BY styleid
Sculli
12-07-2005, 08:09 AM
Thanks, worked like a charm. ;)
Now I just need to associate returned IDs with the names of the styles. I assume that 0 is the default one.
Marco van Herwaarden
12-07-2005, 09:09 AM
SELECT user.styleid, style.title, IF(user.styleid = 0, "Using Default Style", style.title), COUNT(*) AS Count
FROM user AS user
LEFT JOIN style AS style ON (style.styleid = user.styleid)
GROUP BY user.styleid
ORDER BY Count DESC
Sculli
12-07-2005, 03:01 PM
You are a scholar and a gentleman.
Thanks!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.