zoukankan      html  css  js  c++  java
  • mysql group by 组内排序 group by 原理

    mysql group by 组内排序

     

    SELECT * FROM (
    SELECT MAX(id) AS t,wukong_uid, 1 AS tag FROM  toutiao_uid_gathered_wukong GROUP BY wukong_uid
    UNION ALL
    SELECT id AS t ,wukong_uid, 2 AS tag FROM toutiao_uid_gathered_wukong
    ) AS tab ORDER BY wukong_uid ASC , t ASC ;

    验证group by原理 是否来源同一行数据

    SELECT * FROM (
    SELECT MAX(id) AS t,wukong_uid, 1 AS tag,time_script FROM xmt_star_helper_toutiao_uid_gathered_wukong GROUP BY wukong_uid
    UNION ALL
    SELECT id AS t ,wukong_uid, 2 AS tag,time_script FROM xmt_star_helper_toutiao_uid_gathered_wukong
    ) AS tab ORDER BY wukong_uid ASC , t ASC ;

    5914 10301285240 2 1516248413
    6563 10301285240 2 1516264338
    6767 10301285240 2 1516264338
    7774 10301285240 2 1516264338
    7774 10301285240 1 1516193381
    376 10499564112 2 1516193381
    4565 10499564112 2 1516248413
    5019 10499564112 2 1516248413
    5534 10499564112 2 1516248413
    6425 10499564112 2 1516264338
    6879 10499564112 2 1516264338
    7394 10499564112 2 1516264338
    7977 10499564112 2 1516264338
    7977 10499564112 1 1516193381
    360 10818489841 2 1516193381
    360 10818489841 1 1516193381

  • 相关阅读:
    Redis 启动失败
    Java本机直接内存溢出
    Java元数据区域(MetaSpace)OOM
    Java虚拟机本地方法栈溢出例子
    Java堆溢出实例
    C# DllImport CallingConvention选择
    光源选型
    条型光的光路分析
    VS安装包官方下载网址
    win7装.net framework4.6注意事项
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8311048.html
Copyright © 2011-2022 走看看