select * from
(select top 80percent * from table order by id)t
except
(select top 20percent * from table order by id)
在此基础上 查询最大值
select MAX(data1) as maxnum from
(select * from
(select top 80percent * from table order by id)t
except
select top 20percent * from table order by id) tp
查询数据表中 前五条 和后五条数据
SELECT * FROM
(select top 5 * from newnumber order by id )x
UNION ALL
SELECT * FROM
(select top 5 * from newnumber order by id desc)t
还可以这么写
SELECT * FROM
(select top 5 * from newnumber order by id desc)x
UNION ALL
select top 5 * from newnumber order by id