|
|
Archives of the TeradataForum
Message Posted: Mon, 04 Jun 2007 @ 10:44:43 GMT
Subj: | | Re: 7547: Target row updated by multiple source rows |
|
From: | | D silva, Joseph Vinish |
You were almost there ;)
UPDATE TGT1
FROM TEA_MAKING TGT1 ,
(
SELECT MAKER_NM, MADE_QT, INCLUDE_COFFEE_IN
FROM TEA_MADE
QUALIFY ROW_NUMBER() OVER (PARTITION BY TEA_MADE.MAKER_NM ORDER BY
TEA_MADE.INCLUDE_COFFEE_IN, TEA_MADE.MADE_QT DESC) = 1
) SRC1 (MAKER_NM, MADE_QT, INCLUDE_COFFEE_IN)
SET
MADE_QT =+ SRC1.MADE_QT,
INCLUDE_COFFEE_IN=SRC1.INCLUDE_COFFEE_IN
WHERE
TGT1.MAKER_NM=SRC1.MAKER_NM;
Joseph D'silva
| |