SQLite - Selecting And Retrieving Data With Specifications
#1

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.
Reply
#2

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

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
Reply
#4

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)