I've been doing some searches on Google, and can't seem to find the right solution here. Here's the query I'm trying to run:
SELECT material_id, material_manufacturer, material_type, material_container, material_price, CAST(material_container
AS DECIMAL(10,2)) AS material_value FROM materials WHERE material_deleted=0 ORDER BY material_manufacturer ASC, material_value ASC
This doesn't work and here's the error I get form MySQL:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECIMAL ( 10 , 2 ) ) AS material_value FROM materials WHERE material_deleted = 0' at line 1
I want to get a result set where all the material_value fields are numbers, out to two decimal places. I have a 3 and a 3.5 for example in my result set and when I ran this query w/ just CAST as UNSIGNED for example it just returned 3.