I have this query:
select @cost = @cost +
(select top 1 price from
(select top 2 price, date from myTable order by date DESC)
order by date ASC
)
And I get error: Incorrect syntax near the keyword ‘order’.
How to fix this?
I guess this subquery
needs an alias, like this
But I’d write it like this: