SQL语句中的order by可能造成时间重复

前言

SQL语句中的order by可能造成时间重复,当排序的时间都是一样的话,可能造成分页数据重复

sql语句

ini 复制代码
StatementParameter param = new StatementParameter();
StringBuilder sql = new StringBuilder("select * from " + table + " where   regionId = ? ");
param.set(regionId);
if (deviceType != ConstData.DEFAULT_HOSTID) {
  sql.append(" and deviceType= ?  ");
  param.set(deviceType);
}
sql.append(" order by createTime ");
return jdbc.queryForPage(sql.toString(), UserRegionDevice.class, pager, param);

使用order by createTime时,当数据中的createTime时间都是一样的话,分页可能会造成数据重复

相关推荐
2401_835956812 小时前
Golang怎么写基准测试benchmark_Golang基准测试教程【完整】
jvm·数据库·python
Pkmer2 小时前
古法编程: 代理模式
后端·设计模式
文心快码BaiduComate2 小时前
Comate搭载Kimi K2.6,长程13h!
前端·后端·程序员
Pkmer2 小时前
古法编程: 责任链模式
后端·设计模式
KevinSheeran2 小时前
Rust高级代码题 - 手写一个 LRU Cache
后端
阿杰学AI2 小时前
AI核心知识129—大语言模型之 向量数据库(简洁且通俗易懂版)
数据库·人工智能·ai·语言模型·自然语言处理·向量数据库·vector database
SPC的存折3 小时前
D在 Alpine 容器中手动搭建 Discuz 全攻略(包含镜像一键部署脚本,可直接用)
linux·数据库·mysql·缓存
李兆龙的博客3 小时前
从一到无穷大 #67 大查询根因分析 - 从 PinSQL 到 RCRank
数据库·时序数据库
AgCl233 小时前
MYSQL-6-函数与约束-3/17
android·数据库·mysql