需求:对于每篇article,找出price最高的。
方法1:
SELECT s1.article, dealer, s1.price FROM shop s1 JOIN ( SELECT article, MAX(price) AS price FROM shop GROUP BY article) AS s2 ON s1.article = s2.article AND s1.price = s2.price ORDER BY article;
方法2:
select * from shop t where t.price = (select max(age) from shop where t.article = article) order by article;