I have a table below that I need to see if interest rates changed for any loan number within a given period. Below is just sample data, I need to find this information across 2 million rows. How can this be done?
SAMPLE DATA
DATE | LOAN_NUMBER | INTEREST_RATE
04/01/2010 | 1111122 | 0.375
05/15/2011 | 1111122 | 0.375
06/01/2012 | 1111122 | 0.300
07/08/2010 | 1111133 | 0.400
07/01/2011 | 1111133 | 0.450
I tried to do the following:
Select A.Date, A.Loan_Number, A.Interest_Rate
FROM TABLEX A
INNER JOIN TABLEX B ON A.Loan_Number = B.Loan_Number
AND A.Date < B.Date
But this does not get me the results I need.
Any help is appreciated!
Aucun commentaire:
Enregistrer un commentaire