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

MySQL 5.7.29 中 having 1 为什么可以单独使用

  •  
  •   GroupF · Apr 9, 2021 · 2191 views
    This topic created in 1999 days ago, the information mentioned may be changed or developed.

    假设一个 订单状态表

    订单状态表中,代付款,代发货等状态,每一个时期都会存下来

    我要看订单状态表中订单的最新记录。

    我选择分组 group by

    select * from (select * from qy_order_status[表名] qos having 1 order by qos.create_time[时间倒序] desc )b group by b.order_number[订单号分组]

    这样是在 mysql 5.7.29 是可行的,但是我没测更多版本,整的我很迷惑,确实是按照时间最新的列查出来了

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   954 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 19:13 · PVG 03:13 · LAX 12:13 · JFK 15:13
    ♥ Do have faith in what you're doing.