• ADADADADAD

    mysql如何使用分组排序[ 建站问答 ]

    建站问答 时间:2024-12-01 19:16:39

    作者:文/会员上传

    简介:

    mysql中使用分组排序的方法在mysql中使用order by方法实现分组排序实现方法如下:select id, (@rowno := @rowno + 1) as rank,score,(C.end_time - C.start_time) as timeCon

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    mysql中使用分组排序的方法

    在mysql中使用order by方法实现分组排序

    实现方法如下:

    select id, (@rowno := @rowno + 1) as rank,

    score,

    (C.end_time - C.start_time) as timeConsuming,

    start_time,

    real_name,

    tel,

    expiry_code

    from (SELECT *

    FROM (select *

    from t_q_order B

    where B.score > 0

    and B.tel IS NOT NULL

    order by B.score desc,

    (B.end_time - B.start_time) asc,

    B.start_time asc) as A

    group by A.tel

    ORDER BY A.score desc,

    (A.end_time - A.start_time) asc,

    A.start_time asc)

    as C,

    (select @rowno := 0) t

    where (C.end_time - C.start_time) > 5 limit 0,50;

    mysql如何使用分组排序.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysql排序