create proc Proc_bidauction
as begin
with cte as (
select auctionid, MAX(bidamount) as secondhighest from
bidauction
WHERE bidamount NOT IN (select MAX(bidamount) from bidauction )
group by auctionid
)
, cte2 as (
select minutes= datediff(mi, min(biddate), max(biddate))
from (
select top(2) BidDate
from
bidauction
)
bidauction
)
select * from cte cross join cte2
end
No comments:
Post a Comment