Raised This Month: $ Target: $400
 0% 

sql command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
spyvingen
Junior Member
Join Date: Aug 2007
Old 08-27-2007 , 07:27   sql command
Reply With Quote #1

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
spyvingen is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-27-2007 , 08:13   Re: sql command
Reply With Quote #2

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
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
spyvingen
Junior Member
Join Date: Aug 2007
Old 08-27-2007 , 08:46   Re: sql command
Reply With Quote #3

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 is offline
spyvingen
Junior Member
Join Date: Aug 2007
Old 08-27-2007 , 15:04   Re: sql command
Reply With Quote #4

Someone that know if this works??
spyvingen is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-27-2007 , 15:48   Re: sql command
Reply With Quote #5

which sql statement are you using?
same as mine? if yes just add "order by 1 desc"
__________________
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
spyvingen
Junior Member
Join Date: Aug 2007
Old 08-28-2007 , 02:21   Re: sql command
Reply With Quote #6

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 is offline
spyvingen
Junior Member
Join Date: Aug 2007
Old 08-28-2007 , 07:03   Re: sql command
Reply With Quote #7

No more ideas???
spyvingen is offline
Reply



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 16:10.


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