$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";
上面的查询返回值,“Price”有时超过400。 有人可以帮忙吗? 感谢。
答案 0 :(得分:4)
作为临时解决方案,您可以使用:
AND CONVERT(price, DECIMAL) <= 400
但是我强烈建议您更改它,例如DECIMAL(10,2)
(其中2是您要存储的点之后的数字)