I am trying to query the sum of products by category. I have prices for New and Used. I am trying to just show a report of overall sales by category. The new price and used prices are in two different columns.
Here is a general idea of what i am trying to do. This is Mysql 5. My example below is just me talking it out in a general matter to get the idea across.
select sum(if condition is new price new, else priceUsed) as totalValue
group by category
I am not sure how to do the sum with the if statement, if that is even possible.