I have this data in my table:
CODE PRICE
slp_1 EUR 54.95
pvl_1 EUR 64.95
pvl_4 EUR 189.95
int_1 EUR 64.95
I want to group it using a substr function, so I can calculate total sales per 'code', like this:
SELECT sum(PRICE) AS Total,substr(USR_PRODID, 0, 2) AS Prod FROM sales_tbl GROUP BY substr(CODE, 0, 2);
It should result in this:
Prod Total
slp 54.95
pvl 254.90
int 64.95
It's not working:/
Anybody having a clue what I can/should do?