Hi Friends,
In a report I have declared 4 date variables dtA, dtB, dtC, dtD and assigning dates to these variables from 4 different tables.
Case 1:
For example:
dtA = 25/08/2014 (from Vendor Ledger Entry)
dtB = 01/09/2014 (from Purchase Header)
dtC = 29/08/2014 (from Change Log Entry)
dtD = 26/08/2014 (from Vendor - Last Modified Date field)
I need to compare each of the above dates with today's date and take the date which is nearer to today's date. Say in this case 01/09/2014 (dtB) is the one.
Case 2:
I need to add these dates in a temporary table for any date field and sort it in incremental order and I can take the last value. This is also an option. How can I add the above dates in a temporary table?
Can anyone explain me how to do these 2 cases? Also tell me which one is the easiest one.
Thanks in advance.
0
Comments
Your approach using a temp. table won't work as you state it, because the highest date is not necessarily the one closest to today.