|
|
Archives of the TeradataForum
Message Posted: Mon, 30 Sep 2002 @ 14:48:03 GMT
Subj: | | Re: Data transposition |
|
From: | | Jon Downs |
Hi Bruce,
........ it does rely on a phonetype and needs a extra join per column.
SELECT T4.ACCOUNTNO AS ACCOUNT_NUMBER
,TRIM(T1.PHONE) AS PHONE1
,TRIM(T2.PHONE) AS PHONE2
,TRIM(T3.PHONE) AS PHONE3
FROM VIEWDB.ACCOUNT T4
LEFT OUTER JOIN VIEWDB.ACCPHONE T1
ON T4.ACCOUNTNO = T1.ACCNO
AND T1.PHONETYPE = 1
LEFT OUTER JOIN VIEWDB.ACCPHONE T2
ON T4.ACCOUNTNO = T2.ACCNO
AND T1.PHONETYPE = 2
LEFT OUTER JOIN VIEWDB.ACCPHONE T3
ON T4.ACCOUNTNO = T3.ACCNO
AND T1.PHONETYPE = 3
;
hope it helps,
Jon Downs
| |