Hi All, Please see attached image. Here I have a table "inv_stock" with "stockID" as primary key. I want to write a query to show stock quantity of each product with a column "Last vendor" using group by "invProductID" I tried this query
SELECT inv_stock.invProductID, inv_stock.vendorID, SUM( inv_stock.quantity ) AS quantity
FROM inv_stock
GROUP BY inv_stock.invProductID
ORDER BY inv_stock.stockID, inv_stock.created DESC
But instead showing last vendorID it shows first vendorID
Second image is the desired result i want from query Please help