关于数据库记录排序问题

 2023-09-19 阅读 19 评论 0

摘要:数据库: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&#

 数据库: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

 

数据库如何进行表的排序?

 

 

 

 

转载于:https://www.cnblogs.com/qichengXiao/p/5814074.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/79678.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息