Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  / ...  / Tutorial  / Examples of Common Queries  /  Maximum of Column per Group

3.6.3 Maximum of Column per Group

Task: Find the highest price per article.

SELECT article, MAX(price) AS priceFROM   shopGROUP BY articleORDER BY article;+---------+-------+| article | price |+---------+-------+|    0001 |  3.99 ||    0002 | 10.99 ||    0003 |  1.69 ||    0004 | 19.95 |+---------+-------+