create table #temp
(
id int,
分数 decimal(10, 1)
)
insert #temp
select 1,35 union all
select 2,0 union all
select 3,75 union all
select 4,0 union all
select 5,37 union all
select 6,74 union all
select 7,45 union all
select 8,0 union all
select 9,34.5
go
select * from #temp
select top(1) * from #temp order by abs(分数-34)
select * from #temp where 分数=(select MIN(分数) from #temp)
select top(1) with ties * from #temp order by 分数
本文通过一个具体的临时表创建及查询案例,演示了如何使用SQL进行数据筛选与排序,包括记录插入、选择特定条件下的记录、按指定数值排序等操作。
8543

被折叠的 条评论
为什么被折叠?



