I currently have a SQL query like this:
SELECT TOP 10 column_name
FROM table_name
ORDER BY voteColumn DESC
"voteColumn" is integer based. People from my app hit +1 or -1 and feedback is calculated based on current value in "voteColumn".
But there is a problem because there are records which don't have a feedback yet, and their default value is "0". I don't want to show those records. So basically I'm asking is , how to convert this statement into a SQL statement if possible:
SELECT TOP 10 column_name
FROM table_name
ORDER BY voteColumn Desc -> but not return any column_name if value is "0" or return only those who value is above "0".
Any help appriciated.
SELECT TOP 10 column_name
FROM table_name
WHERE voteColumn <> 0
ORDER BY voteColumn Desc
SELECT TOP 10 column_name FROM table_name
WHERE voteColumn > 0
ORDER BY voteColumn Desc
If you want to output results where the voteColumn value is greater than 0, then you just need a WHERE statement.
SELECT TOP 10 column_name FROM table_name
WHERE voteColumn > 0
ORDER BY voteColumn Desc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.