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
ningxiaoxiao
V2EX  ›  MySQL

sql 平均值为什么要 full group by??

  •  
  •   ningxiaoxiao · Apr 29, 2022 · 2725 views
    This topic created in 1502 days ago, the information mentioned may be changed or developed.

    sql 平均值为什么要 full group by??

    5 replies    2022-09-09 15:37:34 +08:00
    itechify
        2
    itechify  
    PRO
       Apr 29, 2022 via Android
    你把 sql 简化贴出来,或许你写错了吧
    ningxiaoxiao
        3
    ningxiaoxiao  
    OP
       Apr 30, 2022
    就是想求 在一个时间点里,以 army_id 为组的 x 的平均值,
    SELECT
    avg(x) as ax,
    avg(y) as ay,
    avg(z) as az,
    FROM
    `path`
    WHERE
    `space` = 'xxxxxxx'
    GROUP BY army_id
    ORDER BY
    `game_time`,
    `team_num`,
    `team_position`

    [![LzI2FJ.png]( https://s1.ax1x.com/2022/04/30/LzI2FJ.png)]( https://imgtu.com/i/LzI2FJ)
    NoahVI
        4
    NoahVI  
       Sep 9, 2022
    你写的 sql 不规范,group by 的字段 需要在聚合函数里面用到
    NoahVI
        5
    NoahVI  
       Sep 9, 2022
    @NoahVI 或者把 sql_mode 改一下。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5935 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 02:04 · PVG 10:04 · LAX 19:04 · JFK 22:04
    ♥ Do have faith in what you're doing.