Multiple group columns ..
Say I have a table looking like this:
http://www.mysql.com/doc/en/Examples.html
And I want to see the highest price per article:
SELECT article, MAX(price) AS price
FROM shop
GROUP BY article
That would work just fine, but what if I want to see who the dealer is ? If I try to just insert 'dealer' in the SELECT statement, it won't show me the right dealer, just the first one it finds in that particular group (like this:)
SELECT article, MAX(price) AS price, dealer
FROM shop
GROUP BY article
How do I overcome this?