Need SQL Statement that selects a column from the first and second row of a table
Posted on 2007-11-19
I have a table that can be ordered by a date field. I need to return a field from the first and second row of the table.
Select (CurrentPrice from Row 1 -, CurrentPrice from Row 2) as PriceDiff
Order By PriceDate Desc
I need data only from rows 1 and 2.
2007-11-16 00:00:00.000 24.58
2007-11-15 00:00:00.000 25.54 ' I need to return (24.58 - 25.54) as PriiceDiff
2007-11-14 00:00:00.000 26.00
2007-11-13 00:00:00.000 25.53
Can this be done ?