I am trying to get the results of a SUM query on a table that shows totals of some items sold. The items are broken down into item_price, quantity, and discount_percent. I am multiplying the SUM of this equation by the SUM of a quantity equation. Here is what I want my SQL query to do, and it does not act like it is correct. Any pointers or help would be greatly appreciated. Here is my SELECT:
SELECT SUM(invoice_items.discount_percent / 100 + 1 * invoice_items.item_price) FROM invoice_items
I need to multiply the discount by the item price to get a result, then sum that all up, as there are multiple items with different discounts. I am using a repeating region for this same idea in a different page, but there it displays each item, here i need to just display the sum of all the items for reporting daily totals, and the like.
Thanks
-Trent