Hey guys,
Is it possible to have more complicated database queries?
Currently I can only get SELECT, FROM, WHERE and LIMIT to work
I am trying to create a function to return the average level of all players.
This is an easy database query: SELECT AVG (level) FROM players;
Is there a way to make this work in LUA?
this does not work: db.getResult("SELECT AVG `level` FROM `players`;")
the server seems to reads "AVG" as the column, and so everything goes to shit from there.
Thanks a lot,
Michael
EDIT: OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: AVG (SELECT AVG "level" FROM "players"
Is it possible to have more complicated database queries?
Currently I can only get SELECT, FROM, WHERE and LIMIT to work
I am trying to create a function to return the average level of all players.
This is an easy database query: SELECT AVG (level) FROM players;
Is there a way to make this work in LUA?
this does not work: db.getResult("SELECT AVG `level` FROM `players`;")
the server seems to reads "AVG" as the column, and so everything goes to shit from there.
Thanks a lot,
Michael
EDIT: OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: AVG (SELECT AVG "level" FROM "players"
Last edited: