進击の程序猿

导航

关于数据库记录排序问题

 数据库:mysql

问题描述:同一条sql语句,查询结果不同。

sql语句:

select id,user_name,total_score from guide_info where identity_tag=0 ORDER BY total_score LIMIT 0,10;

select id,user_name,total_score from guide_info where identity_tag=0 ORDER BY total_score LIMIT 0,15;

表:sisa.guide_info

 

 

当这个接口在用作(按总分排序)分页列出导购id 的时候会出问题:

app端是分页获取的 0-5个获取了 (绪雄 陈)  6-10个的时候又获取(绪雄 陈)

会出现重复的情况。

 

这个sql语句只是我模拟的状况,

在敏兔中真正出现bug的接口是  按评分/订单数量排序分页获取预约了的导购。

 

 

 

 

我的解决方案:  在order by 加id字段。 就是加多一个排序条件。

 

全部数据列出:

select id,user_name,total_score from guide_info where identity_tag=0 ORDER BY total_score

 

 

 

 

 

posted on 2016-08-27 23:27  進击の程序猿  阅读(1061)  评论(0编辑  收藏  举报