select * from(select no=row_number() over(partition by Bid order by getdate()),* from BidWinningNotice) twhere no=1 AND SID=238 AND BWMType=1