![]() |
|
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
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||