SA-MP Forums Archive
SQLite - Selecting And Retrieving Data With Specifications - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite - Selecting And Retrieving Data With Specifications (/showthread.php?tid=514527)



SQLite - Selecting And Retrieving Data With Specifications - DrakeX - 22.05.2014

Is there a way to select or sort data from a query and ensure it's greater then a specified integer? Such as...

pawn Код:
new DBResult:result;
result = db_query(database, "SELECT `VALUE` FROM `TABLE` ORDER BY (`VALUE` * 1) WHERE `VALUE` > `0`");
db_free_result(result);
I'm trying to retrieve data, but I'd like it to only retrieve entries from the database that are greater then 0. Thanks.


Re: SQLite - Selecting And Retrieving Data With Specifications - Mark_Weston - 22.05.2014

You're doing it correctly, are you getting any errors or anything?


Re: SQLite - Selecting And Retrieving Data With Specifications - DrakeX - 22.05.2014

Quote:
Originally Posted by Mark_Weston
Посмотреть сообщение
You're doing it correctly, are you getting any errors or anything?
Oh, I am? What I had wrote was just an example of something I was looking for, I honestly didn't know such a thing could be queried. Thanks.

Edit: Using this include, I'm receiving this:

Код:
[22:26:25] (db_query) Error: near "WHERE": syntax error



Re: SQLite - Selecting And Retrieving Data With Specifications - Konstantinos - 22.05.2014

pawn Код:
"SELECT VALUE FROM TABLE WHERE VALUE > 0 ORDER BY VALUE ASC"



Re: SQLite - Selecting And Retrieving Data With Specifications - Mark_Weston - 22.05.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
"SELECT VALUE FROM TABLE WHERE VALUE > 0 ORDER BY VALUE ASC"
Oh yeah shit.

Here if you want to ORDER BY.

http://www.w3schools.com/sql/sql_orderby.asp