I am trying to turn my avg value in to a decimal, but am getting a syntax error:
1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INT, avg(item_price)) as total_price, count(basket_item) a' at line 4 in
my sql:
SELECT
item_id,
item_name,
CONVERT(INT, avg(item_price)) as total_price,
count(basket_item) as quantity,
item_price
FROM basket b, items i
WHERE b.basket_user = ?
AND i.item_id = b.basket_item
AND i.item_quantity > 0
I have tried cast too but am getting the same error, I am using xampp php 7 version