cjard
May 24th, 2005, 11:59 AM
I have a table with 4 columns:
date_created, date_effective, person_id, credit_limit
i need to find the max(date_created) together with the max(date_effective) for each person_id, and the credit_limit related to that dates and person
hence we look for the max(date_created) when grouped by person_id, linked to the max(date_effective) for this combination, then we find the credit limit for this combination of 3..
and im finding it really hard work without self-joining the table. any tips?
dateC, dateE, person, credit
1,1,jim,1000
1,2,jim,900
1,3,joe,1500
2,2,sue,1200
3,3,sally,500
4,4,bob,1000
4,5,bob,1500
obviously, if i just group by the person id, i get one person id, one date_created and one date_effective
but i dont want to have to self-join that resultset to the table to pull out the client limit for those dates. is there anything i can do?
date_created, date_effective, person_id, credit_limit
i need to find the max(date_created) together with the max(date_effective) for each person_id, and the credit_limit related to that dates and person
hence we look for the max(date_created) when grouped by person_id, linked to the max(date_effective) for this combination, then we find the credit limit for this combination of 3..
and im finding it really hard work without self-joining the table. any tips?
dateC, dateE, person, credit
1,1,jim,1000
1,2,jim,900
1,3,joe,1500
2,2,sue,1200
3,3,sally,500
4,4,bob,1000
4,5,bob,1500
obviously, if i just group by the person id, i get one person id, one date_created and one date_effective
but i dont want to have to self-join that resultset to the table to pull out the client limit for those dates. is there anything i can do?