|
|
Archives of the TeradataForum
Message Posted: Sun, 04 Jun 2006 @ 21:39:53 GMT
Subj: | | Re: Customer relationship algorithm |
|
From: | | Dieter Noeth |
Anomy.Anom wrote:
| I have a set of different customer accounts with open and closure dates. If an account is still open the closure date is null. | |
| For a given customer I need to work out the full series of open and closure dates for each customer relationship with the supplier. | |
| A customer can have multiple accounts open at any point in time, the account open and closure dates can overlap. Some accounts may still be
open. | |
| Without resorting to recursive programming techniques I can't see how to do this in SQL. | |
Hi Anomy,
sounds like you want a minimal cover of an overlapping set of intervals:
Try groups.google.com and search for "shortest interval coalesce", this is probably what you want. The query i posted there used Teradata and
could be used as a starting point.
Dieter
| |