随笔分类 -  数据库

日常工作中用到的一些知识点
SQL 的分页查询
摘要:1.对有序结果的分页查询: 语法: order 字段 ASC/DESC offset xx rows fetch next yy rows only 例如:取分页的第3页的数据,每页显示5条数据 Select * From Customer Order By ID Asc Offset (3-1)* 阅读全文
posted @ 2021-12-29 18:50 相顾无言泪千行 阅读(552) 评论(0) 推荐(0)
Sql 时间戳和时间之间的相互转换
摘要:1. 时间戳- > 普通时间(Sql Servere) Declare @time bigintset @time=1631081001 --2021-09-08 14:03:21SELECT DATEADD(second,@time,'1970-01-01 08:00:00') result: 2 阅读全文
posted @ 2021-10-13 10:43 相顾无言泪千行 阅读(2481) 评论(0) 推荐(0)
分组后获取最新记录信息
摘要:(1) Select * From TABLE_NAME_MessageGroup G Inner Join (select * from TABLE_NAME_MessageDetail Dwheregroup_typein( select group_type from TABLE_NAME_M 阅读全文
posted @ 2021-10-12 10:53 相顾无言泪千行 阅读(125) 评论(0) 推荐(0)