mssqlserver查询方法
其实我做了最简的就是如下写法
| 代码如下 | 复制代码 |
|
上一条记录的SQL语句: select top 1 * from news where newsid 下一条记录的SQL语句: select top 1 * from news where newsid>id order by newsid ASC |
|
另一种写未能
id是指当前数据news_id参数
方法一:
| 代码如下 | 复制代码 |
|
string nextSql = "select top 1 * from news where news_id > " + id + " order by news_id ASC" |
|
方法二:
| 代码如下 | 复制代码 |
|
|
|
mysql查询上一条与下一条的办法
如果ID是主键或者有索引,可以直接查找:
方法1:
| 代码如下 | 复制代码 |
| 1.select * from table_a where id = (select id from table_a where id < {$id} order by id desc limit 1); 2.select * from table_a where id = (select id from table_a where id > {$id} order by id asc limit 1); |
|
方法2:
| 代码如下 | 复制代码 |
| 1.select * from table_a where id = (select max(id) from table_a where id < {$id}); 2.select * from table_a where id = (select min(id) from table_a where id > {$id}); |
|
其他更优的暂时还没想出来
《黎明杀机》开发商正开发新的《Serious Sam》游戏 由Devolver发行
超英派遣中心即将登陆Xbox Play Anywhere 深入了解这款独特而备受喜爱的冒险游戏
在《Hunter: The Reckoning – Deathwish》中怎么从猎物蜕变为猎手
《The Expanse: Osiris Reborn》——深入了解玩法 新同伴 封闭测试及发行窗口
Alien Deathstorm 科幻生存与动作结合 打造全新第一人称恐怖混合体验
宝可梦公司已在考虑未来可用口袋妖怪总数达到“或许一万只”
幸存者村庄2
怪可爱的店折相思菜单
怪可爱的店折相思菜单是一款画风治愈的模拟经营佳作,内置折相思菜单解锁多项便利功能
lol电竞经理人手游
lol电竞经理人手游让你可以成为职业的电竞经理人,在游戏中掌控游戏的走向!豪华阵
梦幻奶茶屋小游戏
梦幻奶茶屋是一款主打温馨治愈氛围的休闲经营作品,玩家将化身元气满满的奶茶店店长,
萌宠养成物语无限金币版
萌宠养成物语无限金币版是一款治愈系模拟养成游戏,以可爱卡通画风构建温馨虚拟世界,