(mysql.info) example-maximum-column-group-row
Info Catalog
(mysql.info) example-maximum-column-group
(mysql.info) examples
(mysql.info) example-user-variables
3.6.4 The Rows Holding the Group-wise Maximum of a Certain Field
----------------------------------------------------------------
_Task: For each article, find the dealer or dealers with the most
expensive price._
This problem can be solved with a subquery like this one:
SELECT article, dealer, price
FROM shop s1
WHERE price=(SELECT MAX(s2.price)
FROM shop s2
WHERE s1.article = s2.article);
Info Catalog
(mysql.info) example-maximum-column-group
(mysql.info) examples
(mysql.info) example-user-variables
automatically generated byinfo2html