日期:2014-05-17 浏览次数:20454 次
;with ct as (select row_number() over (partition by createUid order by asid) num ,* from AuctionSell)
select * from ct
where num=2 or num=(select max(num) from ct b where createuid=ct.createuid ) AND NUM=1
select * from
(select row_number() over (partition by createUid order by asid) num ,* from AuctionSell) ct
where num=2 or num=(select max(num) from ct b where createuid=ct.createuid ) AND NUM=1
;with ct as
(
select row_number() over(partition by createUid order by asid) row_id
,count(*) over(partition by createUid) row_count,*
from AuctionSell
)
select *
from ct
where row_id=case when row_count>1 then 2 else 1 end