I am running the following MySQL query to filter the number of listings with prices within a certain range.
SELECT `listing_id`, `price` FROM (`listings`)
WHERE `post_timestamp` BETWEEN (NOW() - 0 AND NOW() - 5)
AND `price` > '0' AND `price` < '10000'
ORDER BY `post_timestamp` desc
Problem: This does not give me any results although there are rows where the price column has values between 0 and 10,000.
Now the following SQL query returns the correct results
SELECT `listing_id`, `price` FROM (`listings`)
WHERE `post_timestamp` BETWEEN (NOW() - 0 AND NOW() - 5)
AND `price` < '10000'
ORDER BY `post_timestamp` desc
But this query below returns no results!!
SELECT `listing_id`, `price` FROM (`listings`)
WHERE `post_timestamp` BETWEEN (NOW() - 0 AND NOW() - 5)
AND `price` > '0'
ORDER BY `post_timestamp` desc
This is really confusing me, wonder if anyone have an explanation/solution for this?
Edit The following code gives me results!
SELECT `listing_id`, `price` FROM (`listings`)
WHERE `price` > '0'
Field type: int(8)
Removing quotes around numerical values do not make a difference
price?