zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    sql中触发器的使用
    sql中优化查询
    sql中case when语句的使用
    CSRF学习小结
    javascript正则表达式笔记
    elementUI单选框获取值
    elementUI内置过渡(折叠)
    elementUI内置缩放过渡(缩放)
    elementUi内置过渡动画(淡入)
    创建koa2项目
  • 原文地址:https://www.cnblogs.com/alamps/p/7911690.html
Copyright © 2011-2022 走看看