G
Guest
Any ideas regarding the SQL necessary to perform the following
I want to calculate the Number of Days Between the EFF DATE BONUS field, within each EMPLID and INCOME CODE group. Rank is a field that ranks the EFF DATE BONUS field from most current to oldest (within each EMPLID and INCOME CODE group). I need a calculation that subtracts Rank from Rank x +1 for each EFF DATE BONUS within each EMPLID AND INCOME CODE. The DaysBetween column displayed contains the actual calcs I'm looking for (did it in Excel). Any ideas
EMPLID INCOME CODE EFF DATE BONUS Rank TargetType DaysBetwee
74870 BON1 37968 1 NEW
74870 BON1 37772 2 NEW 19
74870 BON1 37689 3 OLD 8
74870 BON1 37177 4 OLD 51
74870 BON1 36829 5 n/a 34
74870 BON2 37772 1 NEW
74870 BON2 37716 2 OLD 5
74870 BON2 37689 3 OLD 2
74870 BON2 37177 4 OLD 51
74870 BON2 36829 5 n/a 34
74870 BON3 37772 1 NEW
74870 BON3 37689 2 OLD 8
74870 BON3 37514 3 NEW 17
74870 BON3 37177 4 OLD 33
74870 BON3 36829 5 n/a 34
74870 BON4 37912 1 NEW
74870 BON4 37884 2 NEW 2
74870 BON4 37772 3 NEW 11
74870 BON4 37689 4 OLD 8
74870 BON4 37514 5 NEW 17
74870 BON4 37177 6 OLD 33
74870 BON4 36829 7 n/a 34
I want to calculate the Number of Days Between the EFF DATE BONUS field, within each EMPLID and INCOME CODE group. Rank is a field that ranks the EFF DATE BONUS field from most current to oldest (within each EMPLID and INCOME CODE group). I need a calculation that subtracts Rank from Rank x +1 for each EFF DATE BONUS within each EMPLID AND INCOME CODE. The DaysBetween column displayed contains the actual calcs I'm looking for (did it in Excel). Any ideas
EMPLID INCOME CODE EFF DATE BONUS Rank TargetType DaysBetwee
74870 BON1 37968 1 NEW
74870 BON1 37772 2 NEW 19
74870 BON1 37689 3 OLD 8
74870 BON1 37177 4 OLD 51
74870 BON1 36829 5 n/a 34
74870 BON2 37772 1 NEW
74870 BON2 37716 2 OLD 5
74870 BON2 37689 3 OLD 2
74870 BON2 37177 4 OLD 51
74870 BON2 36829 5 n/a 34
74870 BON3 37772 1 NEW
74870 BON3 37689 2 OLD 8
74870 BON3 37514 3 NEW 17
74870 BON3 37177 4 OLD 33
74870 BON3 36829 5 n/a 34
74870 BON4 37912 1 NEW
74870 BON4 37884 2 NEW 2
74870 BON4 37772 3 NEW 11
74870 BON4 37689 4 OLD 8
74870 BON4 37514 5 NEW 17
74870 BON4 37177 6 OLD 33
74870 BON4 36829 7 n/a 34