3.6.3 每组中列的最大值

任务: 找出每篇文章的最高价格.

  1. SELECT article, MAX(price) AS price
  2. FROM shop
  3. GROUP BY article
  4. ORDER BY article;
  5. +---------+-------+
  6. | article | price |
  7. +---------+-------+
  8. | 0001 | 3.99 |
  9. | 0002 | 10.99 |
  10. | 0003 | 1.69 |
  11. | 0004 | 19.95 |
  12. +---------+-------+