![]() |
|
Archives of the TeradataForumMessage Posted: Wed, 31 Dec 2003 @ 16:57:02 GMT
For the last mebership date for each customer -
select *
from MEMBERSHIPS
group by CUST_ID
qualify rank(MEMBERSHIP_DATE DESC) = 1
For the first mebership date for each customer -
select *
from MEMBERSHIPS
group by CUST_ID
qualify rank(MEMBERSHIP_DATE ASC) = 1
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 30 Jun 2008 | ||||||||||||||||||||||||||||||||||||||||||||||||