Reputation: 61
$sql = "(SELECT * FROM table1 WHERE col1 LIKE '%Computers%'
AND PRICE <= 400
AND BUYURL IS NOT NULL
AND IMAGEURL IS NOT NULL )
UNION
(SELECT DISTINCT * FROM table2 WHERE col2 LIKE '%desktop computer%'
AND PRICE <= 400
AND BUYURL IS NOT NULL
AND IMAGEURL IS NOT NULL )
ORDER BY PRICE ASC";
above query is returning value with 'Price' sometimes more than 400. can anyone help? thanks.
Upvotes: 0
Views: 57
Reputation: 255015
As a temporary solution you could use:
AND CONVERT(price, DECIMAL) <= 400
But I strongly recommend you to change it so something like DECIMAL(10,2)
(where 2 is the amoung of digits after the point you want to store)
Upvotes: 4