`
lanhuidong
  • 浏览: 226248 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

MySQL先排序后分组(order by first then group by)

阅读更多
SELECT * FROM (SELECT * FROM result r WHERE r.activity_id = 2 ORDER BY r.score DESC,r.elapsed_time,r.play_time) t
GROUP BY t.player ORDER BY t.score DESC,t.elapsed_time,t.play_time;

 

分享到:
评论

相关推荐

    mysql中的一些稍微复杂用法实例代码

    ORDER BY first_lesson_time ASC LIMIT 1) AS first_time, (SELECT deal_user_id FROM jx_strategy WHERE jx_lesson_plan_order_id = o.id AND STATUS <> 7 AND deal_user_id <> 0 ORDER BY id DESC LIMIT ...

    Head First SQL阅读笔记

    - **分组**: `GROUP BY column_name` 对结果集中的一列或多列进行分组。 - **统计函数**: - `SUM(column_name)` 计算列值之和。 - `AVG(column_name)` 计算列值的平均值。 - `MIN(column_name)` 返回列中的最小值...

    不同条件的日期查询 和同年查询

    ORDER BY date ASC; ``` 通过以上知识点的学习,初学者可以更好地理解和掌握如何在 SQL 中处理日期相关的查询需求。这些技能不仅对于数据分析师、数据库管理员等职业至关重要,也对所有从事 IT 行业的人来说都是...

    NBEARLISY使用

    queries with ORDER BY, GROUP BY, PAGING, INNER JOIN, BATCH OPERATION...- Most common database operations we may met in our development life, which significantly simplifies database operations from our...

    Foundations for Analytics with Python O-Reilly-2016-Clinton W. Brownley

    It transitions to an illustration of potential problems with this method of parsing and then presents an example of how to avoid these potential problems by parsing a CSV file with Python’s csv ...

    sql注入过滤字典.txt

    - `order by`:排序。 - `concat`:字符串拼接。 - `group by`:分组。 - `benchmark`:性能测试函数。 - `length`:获取长度。 - `in`:检查是否在列表中。 - `is`:进行比较。 - `as`:别名。 - `like`:模式匹配...

    oracle学习文档 笔记 全面 深刻 详细 通俗易懂 doc word格式 清晰 连接字符串

    2. 网状结构模型:按照网状数据结构建立的数据库系统称为网状数据库系统,其典型代表是DBTG(Data Base Task Group)。 3. 关系结构模型:关系式数据结构把一些复杂的数据结构归结为简单的二元关系(即二维表格形式)。...

Global site tag (gtag.js) - Google Analytics