Looking to run a select query to filter products by size, however the column Product_Size has characters after the number, for example 'inches'. I have tried the below but it brings back no results.
SELECT * FROM `products` where Product_size BETWEEN '2 inches' AND '4.9 inches'
How do I strip the word 'inches' from the query?
You can use replace()
SELECT * FROM products
where Category_List =1 and Category_List_2=7 and
Designed_For_Who LIKE '%%' and (RRP between '0' and '100000') and
Product_size BETWEEN cast(replace('2 inches',' inches','') as int) AND
cast(replace('4.9 inches',' inches','') as int)
ORDER BY Name ASC