I have a table named, "myorder".
I want to select the information from it as described on the image below:
Increasing id, and grouping the same product_ids together.
My sql command didn't work out:
PHP Code:SELECT f.*
FROM myorder f
INNER JOIN (SELECT product_id, MAX(id) AS Ordered GROUP BY product_id) o
ON f.product_id = o.product_id
ORDER BY o.Ordered



Reply With Quote

Bookmarks