Thread: [Solved] [CSGO] Help for mysql
View Single Post
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 02-21-2019 , 04:20   Re: [CSGO] Help for mysql
Reply With Quote #5

Quote:
Originally Posted by Marttt View Post
Did it work?

I don't think you need all these casts, and the outer cast, since when both numbers are decimal the result will be decimal anyway

You can try these others "selects" if they work would be faster since it will consume less CPU

Code:
SELECT * FROM test ORDER BY CAST(kills AS DECIMAL)/CAST(deaths as DECIMAL) DESC;
Code:
SELECT * FROM test ORDER BY CAST(kills / deaths) as DECIMAL DESC;
But looking your needs, I think you must add another "order by desc" because you can have scenarios where both kills/death results in same value, so you need do another check and order by the most client kills

I made and example below
https://paiza.io/projects/PrMhFtm8Mv...language=mysql

In my opinion you just need do that:

Code:
ORDER BY kills/deaths DESC, kills DESC;
nice!!
thank you!!

I used this line:
PHP Code:
Format(querysizeof(query), "%s  ORDER BY kills/deaths DESC"query); 
thank you guys :X
Dr.Mohammad is offline