I have a table full of magazines, and need to extract the latest unique issue of each magazine.
Ive tried
SELECT DISTINCT
magazine
F
None of the given answers are correct, as they return an disassociated set of data that does not represent one exact column. The id may not be the id from the same row as the onsale value.
The following will work:
SELECT
id, onsale, magazine
FROM (
SELECT
id, onsale, magazine
FROM
product
ORDER BY
onsale DESC) AS a
GROUP BY
magazine