• MySQL 5.7.9版本sql_mode=only_full_group_by问题


    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 27
    Server version: 5.7.12 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql> SELECT @@GLOBAL.sql_mode;
        +-------------------------------------------------------------------------------------------------------------------------------------------+
    | @@GLOBAL.sql_mode                                                                                                                         |
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> SET sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> select @@sql_mode;
    +------------------------------------------------------------------------------------------------------------------------+
    | @@sql_mode                                                                                                             |
    +------------------------------------------------------------------------------------------------------------------------+
    | STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
    +------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)


    <select id="countAll" resultType="java.lang.Long" >
    SELECT COUNT(*) FROM (
    SELECT * FROM
    (SELECT * FROM order_bid_did_relation
    ORDER BY TIME DESC) AS T
    GROUP BY T.BID
    ) AS TT
    ORDER BY TT.time DESC
    </select>


    <select id="getAll" resultMap="BaseResultMap" >
    SELECT * FROM (
    SELECT * FROM
    (SELECT * FROM order_bid_did_relation
    ORDER BY time DESC) AS T
    GROUP BY T.BID
    ) AS TT
    ORDER BY TT.time DESC
    limit #{startRow},#{pageSize}
    </select>

  • 相关阅读:
    CSS
    javaScript高级:BOM和DOM
    Layui在弹出层实现轮播图效果
    SQL
    jQuery基础
    清除重复值:distinct
    tomcat的server.xml中进行配置来实现访问本地电脑的图片
    jQuery高级
    javascript基础:ECMAScript
    设计模式六大原则【设计模式学习开篇】
  • 原文地址:https://www.cnblogs.com/alamps/p/7911690.html
Copyright © 2020-2023  润新知