Reputation: 59
I am trying to select information from database but I don't want to select NULL
.
My query:
SELECT percent, cost, userid FROM games ORDER BY `percent` ASC LIMIT 5
and it's selecting NULL
value, how to don't select NULL
.
Upvotes: 1
Views: 30
Reputation: 14982
The IS NOT NULL
can be used in the WHERE
clause.
SELECT percent,cost,userid
FROM games
WHERE `YourAwesomeColumn` IS NOT NULL
ORDER BY `percent` ASC
LIMIT 5
Upvotes: 0
Reputation: 5201
Use a WHERE
statement with the IS NOT null
operator.
SELECT percent
, cost
, userid
FROM games
WHERE percent IS NOT NULL
ORDER BY percent ASC
LIMIT 5
Upvotes: 1