Sql Exists最大值
create table #a(
id int identity(1,1) primary key,
name varchar(20) not null
)
go
-------------------------------------------------
insert into #a
select 'A1' union
select 'B2' union
select 'A3'
select * from #a a where
not exists(select 1 from #a where a.id = id and a.Id > id)
我想取ID最大的那条记录用not exists怎么怎么查三行记录都出来了呀,要怎么写呢?
------解决方案--------------------
-->=看看
ClassID = p.ClassId and ClickNum >= p.ClickNum
------解决方案--------------------为啥要用not exists而不用exists呢?