› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
listen2wind
V2EX  ›  MySQL

请教一个问题: mysql 中使用 group by 如何获取最新一条数据?

  •  
  •   listen2wind · Sep 6, 2022 · 2506 views
    This topic created in 1481 days ago, the information mentioned may be changed or developed.

    mysql 版本:8.0.28

    4 replies  •  2022-09-06 13:39:23 +08:00
    hidemyself
        1
    hidemyself  
       Sep 6, 2022   ❤️ 1
    你需要 rank() over
    spicecch
        2
    spicecch  
       Sep 6, 2022   ❤️ 1
    PARTITION BY
    wxf666
        3
    wxf666  
       Sep 6, 2022   ❤️ 2
    https://dev.mysql.com/doc/refman/8.0/en/example-maximum-column-group-row.html

    文中说了 子查询、相关子查询、自连接、窗口函数 4 种方法
    hay0577
        4
    hay0577  
       Sep 6, 2022   ❤️ 1
    select * from table where id in (select Max(id) from table group by xxx ) 这样
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1869 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 16:13 · PVG 00:13 · LAX 09:13 · JFK 12:13
    ♥ Do have faith in what you're doing.