当前位置:Gxlcms > 数据库问题 > sql问题

sql问题

时间:2021-07-01 10:21:17 帮助过:2人阅读

表中某个指标重复,去掉重复项:

select *
from #temp
where A0107
in (select A0107 from #temp 
group by A0107
having COUNT(A0107)>1
) and id not in (
   select MIN(id) from #temp
   group by A0107
having COUNT(A0107)>1
)
select * from #temp
--实现sql server 中类似于oracle中rownum的关键字,
--我想取出符合条件的第301-310条记录,又不想取出所有数据,有没有好的解决方案?
--插入数据1,2,3,4
select identity(int,1,1) as id,* into #temp from UsrA01
select * from #temp where id between 301 and 310
--1,10插入的数据1,11,21,31,跳十个
select identity(int,1,10) as id,* into #temp1 from UsrA01
select * from #temp1 where id between 301 and 310

sql问题

标签:

人气教程排行