AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   sql command (https://forums.alliedmods.net/showthread.php?t=60117)

spyvingen 08-27-2007 07:27

sql command
 
Hello i would like to have som help with an sql command.

This is my table :
Code:

id          int(10)      NO      PRI      NULL      auto_increment
steamid_killer    varchar(20)    YES          NULL     
steamid_victim    varchar(20)    YES          NULL     
weapon        varchar(15)    YES          NULL     
headshot    varchar(1)    YES          NULL     
killtime    datetime    YES          NULL

And as you see it ill be one line for each kill.
I would like an sql that reads out a list/array with how many kills, deaths and suisude every person have in the past week.

is it possible to make that in one sql command or do i have to make an sql for each value and player.

The thing is that if i have to make it with one sql/player then it would be 90 sql commands each visit and im guesing thats not so fun for the server :)

BR. Jonas

Greenberet 08-27-2007 08:13

Re: sql command
 
kill count:
Code:

select count(*) from YOUR_TABLE where steamid_killer != steamid_victim and steamid_killer = 'STEAM_BLA'
death count:
Code:

select count(*) from YOUR_TABLE where steamid_killer != steamid_victim and steamid_victim = 'STEAM_BLA'
suicide count:
Code:

select count(*) from YOUR_TABLE where steamid_killer == steamid_victim and steamid_victim = 'STEAM_BLA'
dont forget to replace YOUR_TABLE with the actual table name.

*edit*
atm you dont have any date check here because i dont know which sql server you are using, so i cant know which functions they have for date/time

spyvingen 08-27-2007 08:46

Re: sql command
 
i already have those sql commands on the individual score page.

example
http://www.colbro.se/cs

but the thing i would like is to sort the user by kill ratio in the first page so the best player is first in the list like a top 30 list this week

spyvingen 08-27-2007 15:04

Re: sql command
 
Someone that know if this works??

Greenberet 08-27-2007 15:48

Re: sql command
 
which sql statement are you using?
same as mine? if yes just add "order by 1 desc"

spyvingen 08-28-2007 02:21

Re: sql command
 
The thing is i want all that you wrote above but in one single sql statemant if possible so i have everything in my recset so i can loop out the top 10 list from a single sql.

I dont know if its even possible but i t would be godd if you have a solution or somone else.

BR. jonas

spyvingen 08-28-2007 07:03

Re: sql command
 
No more ideas???


All times are GMT -4. The time now is 16:10.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.