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;

猜你喜欢

转载自www.cnblogs.com/chencn/p/12303392.html