• <small id='pPQi5'></small><noframes id='pPQi5'>

    <legend id='pPQi5'><style id='pPQi5'><dir id='pPQi5'><q id='pPQi5'></q></dir></style></legend>

    1. <tfoot id='pPQi5'></tfoot>
        <bdo id='pPQi5'></bdo><ul id='pPQi5'></ul>

        <i id='pPQi5'><tr id='pPQi5'><dt id='pPQi5'><q id='pPQi5'><span id='pPQi5'><b id='pPQi5'><form id='pPQi5'><ins id='pPQi5'></ins><ul id='pPQi5'></ul><sub id='pPQi5'></sub></form><legend id='pPQi5'></legend><bdo id='pPQi5'><pre id='pPQi5'><center id='pPQi5'></center></pre></bdo></b><th id='pPQi5'></th></span></q></dt></tr></i><div id='pPQi5'><tfoot id='pPQi5'></tfoot><dl id='pPQi5'><fieldset id='pPQi5'></fieldset></dl></div>
      1. mysql 分组并排序每个组

        mysql group by and sort each group(mysql 分组并排序每个组)
            <legend id='7qXVV'><style id='7qXVV'><dir id='7qXVV'><q id='7qXVV'></q></dir></style></legend><tfoot id='7qXVV'></tfoot>
            <i id='7qXVV'><tr id='7qXVV'><dt id='7qXVV'><q id='7qXVV'><span id='7qXVV'><b id='7qXVV'><form id='7qXVV'><ins id='7qXVV'></ins><ul id='7qXVV'></ul><sub id='7qXVV'></sub></form><legend id='7qXVV'></legend><bdo id='7qXVV'><pre id='7qXVV'><center id='7qXVV'></center></pre></bdo></b><th id='7qXVV'></th></span></q></dt></tr></i><div id='7qXVV'><tfoot id='7qXVV'></tfoot><dl id='7qXVV'><fieldset id='7qXVV'></fieldset></dl></div>

              <tbody id='7qXVV'></tbody>

            • <bdo id='7qXVV'></bdo><ul id='7qXVV'></ul>

              <small id='7qXVV'></small><noframes id='7qXVV'>

                  本文介绍了mysql 分组并排序每个组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有下表:

                  ID NAME TIME
                  1  A    0
                  2  A    3
                  3  B    1

                  我使用下面的查询产生:

                  I am using the query below which produces:

                  SELECT * FROM `table` GROUP BY `NAME`
                  

                  ID NAME TIME
                  1  A    0
                  3  B    1

                  我想使用 GROUP BY 来生成这样的结果(按时间列折扣排序):

                  And I want use GROUP BY to generate a result like this (discount sort by the TIME column):

                  ID NAME TIME
                  2  A    3
                  3  B    1

                  推荐答案

                  SELECT NAME, MAX(TIME) as TIME 
                  FROM table 
                  GROUP BY time 
                  ORDER BY time DESC
                  

                  这篇关于mysql 分组并排序每个组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)

                    <tfoot id='thlMN'></tfoot><legend id='thlMN'><style id='thlMN'><dir id='thlMN'><q id='thlMN'></q></dir></style></legend>

                          <bdo id='thlMN'></bdo><ul id='thlMN'></ul>

                          <i id='thlMN'><tr id='thlMN'><dt id='thlMN'><q id='thlMN'><span id='thlMN'><b id='thlMN'><form id='thlMN'><ins id='thlMN'></ins><ul id='thlMN'></ul><sub id='thlMN'></sub></form><legend id='thlMN'></legend><bdo id='thlMN'><pre id='thlMN'><center id='thlMN'></center></pre></bdo></b><th id='thlMN'></th></span></q></dt></tr></i><div id='thlMN'><tfoot id='thlMN'></tfoot><dl id='thlMN'><fieldset id='thlMN'></fieldset></dl></div>

                            <small id='thlMN'></small><noframes id='thlMN'>

                              <tbody id='thlMN'></tbody>