Creating a Trigger in MySQL that stores stock levels once a sale takes place I have a basic database for a retail store with 4 tables, one of which stores Order info, one that stores Product info and one that stores Supplier info.

I  am trying to run a query that will display total sum of stock sold figure (in dollars) with a GROUP BY supplier with ROLL UP. I have a feeling that SUM should be in the code but I can't find where to put it, so far I have this:

SELECT ORDERS.OrderPrice, PRODUCT.SupplierID, SUPPLIER.SupplierName
FROM ((ORDERS
INNER JOIN PRODUCT ON ORDERS.ProductID = PRODUCT.ProductID)
INNER JOIN SUPPLIER ON PRODUCT.SupplierID = SUPPLIER.SupplierID)
GROUP BY SupplierName WITH ROLLUP;


The database can be viewed on DB Fiddle here:

https://www.db-fiddle.com/f/qS515ShyFGxgj4h6Ga6HA3/1#&amp;togetherjs=aNgE8G0yMh

Any ideas? Thanks
You must use SUM function with orderPrice

SELECT SUM(ORDERS.OrderPrice), SUPPLIER.SupplierName FROM ((ORDERS INNER JOIN PRODUCT ON ORDERS.ProductID = PRODUCT.ProductID) INNER JOIN SUPPLIER ON PRODUCT.SupplierID = SUPPLIER.SupplierID) GROUP BY SupplierName with ROLLUP