Project 1999

Go Back   Project 1999 > Blue Community > Blue Server Chat

Closed Thread
 
Thread Tools Display Modes
  #11  
Old 03-30-2010, 04:15 PM
Cilraaz Cilraaz is offline
Aviak


Join Date: Mar 2010
Posts: 56
Default

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;
__________________
Cilraaz Xraktz
41 Iksar Monk
Arranla
40 Erudite Enchanter
<Kittens Who Say Meow>
P99 Blue
Last edited by Cilraaz; 03-30-2010 at 04:46 PM.. Reason: Fixed SQL statements
  #12  
Old 03-30-2010, 04:20 PM
Ferok Ferok is offline
Fire Giant


Join Date: Mar 2010
Location: Long Island, NY
Posts: 521
Send a message via AIM to Ferok
Default

No count?
__________________
Kruall - Troll Shaman
Ferok - Dwarf Warrior
  #13  
Old 03-30-2010, 04:29 PM
Cilraaz Cilraaz is offline
Aviak


Join Date: Mar 2010
Posts: 56
Default

Yeah, I missed the count and the group by. Trying to get a quick post in during work and guess I went too quick.
__________________
Cilraaz Xraktz
41 Iksar Monk
Arranla
40 Erudite Enchanter
<Kittens Who Say Meow>
P99 Blue
  #14  
Old 03-30-2010, 04:35 PM
Ferok Ferok is offline
Fire Giant


Join Date: Mar 2010
Location: Long Island, NY
Posts: 521
Send a message via AIM to Ferok
Default

Quote:
Originally Posted by Cilraaz [You must be logged in to view images. Log in or Register.]
Yeah, I missed the count and the group by. Trying to get a quick post in during work and guess I went too quick.
Still fails because you have terms in your select that aren't in your group by, but I know what you mean. This is probably what you meant:

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  
Old 03-30-2010, 04:41 PM
Cilraaz Cilraaz is offline
Aviak


Join Date: Mar 2010
Posts: 56
Default

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.
__________________
Cilraaz Xraktz
41 Iksar Monk
Arranla
40 Erudite Enchanter
<Kittens Who Say Meow>
P99 Blue
Last edited by Cilraaz; 03-30-2010 at 04:45 PM.. Reason: Added last few sentences.
  #16  
Old 03-30-2010, 04:47 PM
Ferok Ferok is offline
Fire Giant


Join Date: Mar 2010
Location: Long Island, NY
Posts: 521
Send a message via AIM to Ferok
Default

Quote:
Originally Posted by Cilraaz [You must be logged in to view images. Log in or Register.]
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.
Guess it just ignores them, since it doesn't make sense to return them.

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  
Old 03-31-2010, 12:10 PM
Yiblaan Yiblaan is offline
Kobold


Join Date: Jan 2010
Location: Chicago, IL
Posts: 129
Default

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  
Old 03-31-2010, 12:19 PM
FatMagic FatMagic is offline
Sarnak

FatMagic's Avatar

Join Date: Oct 2009
Location: Buffalo, NY
Posts: 410
Default

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.
__________________
  #19  
Old 03-31-2010, 12:21 PM
Cilraaz Cilraaz is offline
Aviak


Join Date: Mar 2010
Posts: 56
Default

Quote:
Originally Posted by FatMagic [You must be logged in to view images. Log in or Register.]
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.
It would actually be pretty simple to do. It's more a matter of whether the admins want to publicize that information.
__________________
Cilraaz Xraktz
41 Iksar Monk
Arranla
40 Erudite Enchanter
<Kittens Who Say Meow>
P99 Blue
  #20  
Old 03-31-2010, 12:37 PM
BornOfAshes BornOfAshes is offline
Decaying Skeleton


Join Date: Mar 2010
Posts: 1
Default

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
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:40 PM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.