Thread: Top Players?
View Single Post
Old 29.01.2006, 21:38   #2
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

a single query..

for example...

TOP 10 EXP
-------------
SELECT TOP 10 char_name,exp
FROM user_data
WHERE builder = 0 AND account_id > 0
ORDER by 2 DESC
------------
"builder = 0" hideGMs from list...
"account_id > 0" is to hide deleted/banned players from list...

you can change this query for others things...

for pvp ?
------------
SELECT TOP 10 char_name,duel
FROM user_data
WHERE builder = 0 AND account_id > 0
ORDER by 2 DESC
------------

... and if you want to know the TOP 100 more rich...
something like this...
------------
SELECT TOP 10 char_name as Player,SUM(amount) as Adena
FROM user_data,user_item
WHERE user_data.char_id = user_item.char_id
AND item_type = 57 AND builder = 0 AND warehouse BETWEEN 0 AND 1
GROUP by char_name
ORDER by 2 DESC
------------

Online players ?
-------------------
SELECT TOP 1 world_user
FROM lin2db.dbo.user_count
WHERE (record_time =
(SELECT MAX(record_time)
FROM lin2db.dbo.user_count))



Alliances info
---------------
SELECT pledge.name as Clan,char_name as Lider,alliance.name as Alianza
FROM pledge,user_data,alliance
WHERE user_data.char_id = pledge.ruler_id
AND pledge.alliance_id = alliance.id
AND builder = 0
ORDER by alliance_id

----------------

maybe people who knows a lot of SQL think this querys are very bad, but.. i only learn SQL to use in L2OFF... reading manuals and see examples... i wait help you... i can't share geodatas or others things.. but i can help you with this. :P

user this in ASP or PHP, is very simple, if you need an example to use this in PHP only ask me.
FidoW is offline