I've got a table that looks like this:
Code Mark Date Notional
Beta 5/1/2008 $1,102,451.00
Beta 5/2/2008 $1,102,451.00
Beta 5/5/2008 $1,102,451.00
Beta 5/6/2008 $1,102,451.00
I need to create a table that has all of the Mark Dates in one column and the difference between each adjacent Mark Date when sorted in another column. This is the SQL I've written:
SELECT
Current.[Mark Date],
Prev.[Mark Date],
(DATEDIFF("d", Prev.[Mark Date], Current.[Mark Date])/365)
FROM Notional as Prev, Notional as Current
WHERE (Prev.[Mark Date] = (Current.[Mark Date]-1));
However, this SQL will not join over the weekend 5/5/2008 -> 5/2/2008 for example or on long weekends. How would I go about getting the table to self join over non contiguous dates? Thanks for all the help!