SQL 例子

400阅读 0评论2021-12-15 starb6
分类:Mysql/postgreSQL


1:  分组,再选出每组最大值:
  SELECT article, MAX(price) AS price
     
FROM shop
     
GROUP BY article
     
ORDER BY article;
   
+---------+-------+
   
| article | price | +
   
---------+-------+

   
| 0001 | 3.99 |
   
| 0002 | 10.99 |
    
| 0003 | 1.69 |
    
| 0004 | 19.95 |
     
+---------+-------+
上一篇:Python The beginning....
下一篇:hello_world.py.202201