#11
|
|||
|
Assuming that P99's character table isn't much different from the default PEQ character table, the SQL would just be something like:
SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '5' GROUP BY class; Replace 5 with whatever level you want to check for. That will check for individual characters (not accounts) that have been logged on in the past 7 days, so it would eliminate some mules and unplayed alts from the list. You could even use this to show representation within brackets (ie. "level > '5 AND level < '11'" would give you the 5-10 bracket, etc). Edit: Assuming that it wouldn't put too much strain on the SQL server, you could create a PHP script that would display the different brackets. You'd just need to decide what brackets you wanted it chopped by, but it could pull and display say 1-9, 10-19, 20-29, 30-39, 40-49, and 50. SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '0' AND level < '10' GROUP BY class; SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '9' AND level < '20' GROUP BY class; SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '19' AND level < '30' GROUP BY class; SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '29' AND level < '40' GROUP BY class; SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level > '39' AND level < '50' GROUP BY class; SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level = '50' GROUP BY class;
__________________
| ||
Last edited by Cilraaz; 03-30-2010 at 04:46 PM..
Reason: Fixed SQL statements
|
|
#12
|
|||
|
No count?
__________________
Kruall - Troll Shaman
Ferok - Dwarf Warrior | ||
|
#13
|
|||
|
Yeah, I missed the count and the group by. Trying to get a quick post in during work and guess I went too quick.
__________________
| ||
|
#14
|
||||
|
Quote:
SELECT class, count(distinct id) FROM character_ WHERE timelaston > (UNIX_TIMESTAMP() - 604800) AND level = '50' GROUP BY class; Fortunately I'm doing SQL migrations this week so looking up syntax looks an awful lot like work!
__________________
Kruall - Troll Shaman
Ferok - Dwarf Warrior | |||
Last edited by Ferok; 03-30-2010 at 04:38 PM..
|
|
#15
|
|||
|
http://www.thetimekillers.com/eqemu/test.php
Works fine for me with a limited database to work with. I'll create multiple characters just to fuddle with when I get home tonight. Took another look at it. Yeah, I don't need the timelaston or level in the select. Drop those and it's a more efficient statement.
__________________
| ||
Last edited by Cilraaz; 03-30-2010 at 04:45 PM..
Reason: Added last few sentences.
|
|
#16
|
||||
|
Quote:
I'm a little more familiar with MS-SQL, which I'm pretty sure would throw an error there. Either way, I'm betting that data like this would be done as a nightly / hourly load to the message board db, rather than an on demand directly from the game db. It's not really very important that it's up-to-the-second information. This kind of aggregation isn't overly costly, but more costly than I'm sure it needs to be.
__________________
Kruall - Troll Shaman
Ferok - Dwarf Warrior | |||
|
#17
|
|||
|
Thank Prexus I am not a math major
__________________
~Yiblaan Conjurer
53 Magician of P1999~ ~Leader of <Tears of Prexus>~ Magician of the 2 Seas of Norrath! ~Bearded~ 51 Cleric ::::RED 99:::: ~Sylvana Whisperwind~ 45 Druid ~Yiblaangel~ 33 Paladin of Prexus | ||
|
#18
|
|||
|
I'd like to see if you guys can get this worked out... it would be cool to see the class distribution on the server.
__________________
Tetsusaru - 20 Monk | Glaak - 10 Shaman EQLite - 1.35GB & Runs P99 on a USB Drive Original & Custom P99 Icons | ||
|
#19
|
||||
|
Quote:
__________________
| |||
|
#20
|
|||
|
assuming that the database is MS SQL... I don't think it is though.
but yeah, you should be able to generate a logdump of the active players and then sort them like Ferok suggested above. I for one would enjoy seeing the results of the queries, it's kind of neat to see trends | ||
|
|
|