Hi there,
I couldn't work out a SQL to archive this

, can somebody help me out?
For the following records in source:
CUST_ID LE_ID_BUSN FMT_CD BUH_EFF_TS BUH_END_TS
--------------- ----------- --------------- -------------------------- --------------------------
6547 6547 lc 1965-12-31-00.00.00.000000 1966-01-01-00.00.00.000000
6547 6547 lc 1966-01-01-00.00.00.000000 2002-02-20-09.18.22.844000
6547 6547 lc 2002-02-20-09.18.22.844000 2003-09-11-10.47.01.022346
6547 6547 lc 2003-09-11-10.47.01.022346 2003-09-11-10.47.15.577973
6547 6547 pa 2003-09-11-10.47.15.577973 2006-09-15-08.14.03.490208
6547 6547 pa 2006-09-15-08.14.03.490208 2006-09-15-08.15.16.412741
6547 6547 pa 2006-09-15-08.15.16.412741 2006-09-15-08.16.10.878624
6547 6547 pa 2006-09-15-08.16.10.878624 2006-09-15-08.18.42.362458
6547 6547 pa 2006-09-15-08.18.42.362458 2006-09-15-08.18.45.443437
6547 6547 lc 2006-09-15-08.18.45.443437 -
also:
CUST_ID FMT_CD BUH_EFF_TS BUH_END_TS LE_ID_BUSN
--------------- --------------- -------------------------- -------------------------- -----------
100719 pa 1965-12-30-00.00.00.000000 1965-12-31-00.00.00.000000 100719
100719 pa 1965-12-31-00.00.00.000000 1965-12-31-00.00.00.000000 100719
100719 pa 1966-01-01-00.00.00.000000 2003-11-26-08.52.08.298775 100719
100719 a 2003-11-27-08.52.52.542204 2004-02-09-10.58.18.870532 100719
100719 a 2004-02-10-10.58.45.913380 - 100719
I want to create the target records by SQL:
cust_id le_busn_id fmt_cd startdate enddate
6547 6547 LC 1965-12-31 2003-09-11
6547 6547 PA 2003-09-11 2006-09-15
6547 6547 LC 2006-09-15 -
100719 100719 PA 1965-12-30 2003-11-26
100719 100719 A 2003-11-27 -
Thanks in advance.