Jump to content

[Solved]Sqlite Top 10 Values


Gus_ftw

Recommended Posts

Posted (edited)

Hi, i have problems to get the top 10values from a SQLite database.

The first code gives me the values but I want it to be sorted like from the richest players to the poorest players with a limit of 10 player.

Example.

1. 1,901,011$

2. 1,871,110$

3. 1,681,191$

etc.

1. code

function getData( ) 
    return dbPoll ( dbQuery ( db, "SELECT * From (Select * from data ORDER BY money desc) LIMIT 10 " ), -1 ) 
end 
setTimer(getData, 5000, 0) 

This is how this code returns:

b198f196de.png

Edited by Guest
Posted
function getData( ) 
    return dbPoll ( dbQuery ( db, "SELECT * FROM data ORDER BY money DESC LIMIT 10" ), -1 ) 
end 
setTimer(getData, 5000, 0) 

It returns the same value as my code.

b198f196de.png

Posted

@Arsilex I don't know why mine doesn't work. I think that it might be from the datatype of the column.

dbExec(db, "CREATE TABLE IF NOT EXISTS data (account TEXT, money INT)") 

6dc8596f84.png

Posted

Column type is okay, it might be because you have those commas like 99,693,897.

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted

I just saw that your image is fine but something in your database is bad because as you see the values are 99, 96, 93, 9 (90), 87, 86, 8 (80), 79 etc looks like the commas are the issue here as GTX said

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...