Alex_TD

Mysql---9 分页和排序

1.分页  limit  offset 和排序 order by   desc  降序  asc 升序

  select  a.1,2,3,4 from a

       inner join b

        on a.1=b.1

           inner join c

            on c.2=b.2  

                where 3='xxx'

                 order by 4 desc (asc);

2.分页是所有select where条件的最后一项; limit  起始值,行数   

    limit    (n-1)*pageSize  ,pageSize      页数=数据总数/pageSize   ---pageSize 页面大小;

      

select  a.1,2,3,4 from a

       inner join b

        on a.1=b.1

           inner join c

            on c.2=b.2  

                where 3='xxx'

                 order by 4 desc (asc)  

                  limit 0,10;

posted on 2020-02-13 18:40  Alex_TD  阅读(155)  评论(0编辑  收藏  举报