delete from table where id in (select max(id) from table union select min(id) from table)
to rockmanhqu(洛克)对不起没说清,不是删除数据,只是在求和的时候不要这几个数据 实际就是做评分的,去掉两个最大值,去掉两个最小值,但不能把把原数据删除了,我也考虑用临时表,不过我不会用,能重写一个吗?
select * from table where id not in (select max(id) from table union select min(id) from table)
yun,你们都错了,正确的 select select * from table where id not in (select top 100 from table order by id union select top 50 from table order by id desc) 100 \50都是你要的那个N
(select max(id) from table
union
select min(id) from table)
实际就是做评分的,去掉两个最大值,去掉两个最小值,但不能把把原数据删除了,我也考虑用临时表,不过我不会用,能重写一个吗?
(select max(id) from table
union
select min(id) from table)
select select * from table where id not in
(select top 100 from table order by id
union
select top 50 from table order by id desc)
100 \50都是你要的那个N