I have got a table like so...
ID On-Date Off-Date Off-Reason
1 04/07/2004 04/06/2004 DEF
2 07/07/2004 10/07/2004 WLR
1 04/09/2004 04/10/2004 DEF
1 04/11/2004
I want to know the difference between todays date and the on-date less the sum of the differences between Off-Date and the next On-Date where the Off-Reason equals DEF.
I have managed to sort it to give the correct results if there is 1 extra entry (using Maximum On-Date) but I am stuck when lookin to every entry.
I am using CR9 with SQL2000
Any help will be greatly received..!
Thanks
Vis
ID On-Date Off-Date Off-Reason
1 04/07/2004 04/06/2004 DEF
2 07/07/2004 10/07/2004 WLR
1 04/09/2004 04/10/2004 DEF
1 04/11/2004
I want to know the difference between todays date and the on-date less the sum of the differences between Off-Date and the next On-Date where the Off-Reason equals DEF.
I have managed to sort it to give the correct results if there is 1 extra entry (using Maximum On-Date) but I am stuck when lookin to every entry.
I am using CR9 with SQL2000
Any help will be greatly received..!
Thanks
Vis