I wish to update a record by setting the values through an select statemenet..
The query should look something like this;
UPDATE FCR.HEADER
SET (Value1,Value2,Value3)
(SELECT sum(AMOUNT_FC),sum(AMOUNT_DC ), value1
FROM tableA
WHERE DATE = to_date('02/0开发者_开发知识库5/2006', 'dd/mm/yyyy')
GROUP BY UNIT_ID, TRX_DATE)
WHERE TRX_DATE = to_date('02/05/2006', 'dd/mm/yyyy')
AND column14 = 'some value'
What is the proper format in order for this query to work ?
UPDATE FCR.HEADER
SET Value1 = (SELECT sum(AMOUNT_FC)
FROM tableA
WHERE DATE = to_date('02/05/2006', 'dd/mm/yyyy')
GROUP BY UNIT_ID, TRX_DATE),
Value2 = (SELECT sum(AMOUNT_DC)
FROM tableA
WHERE DATE = to_date('02/05/2006', 'dd/mm/yyyy')
GROUP BY UNIT_ID, TRX_DATE),
Value3 = (SELECT sum(AMOUNT_DC)
FROM tableA
WHERE DATE = to_date('02/05/2006', 'dd/mm/yyyy')
GROUP BY UNIT_ID, TRX_DATE)
WHERE TRX_DATE = to_date('02/05/2006', 'dd/mm/yyyy')
AND column14 = 'some value'
it would be better to have a Variable of type Date to hold to_date(...).
Hope this helps.
精彩评论