Hi guys,
So this is my question. I have a table where I am adding data, based on two other tables. The problem is that when I make a normal join I get an error saying that the subquery returned more than 1 value. This is because in the list I have there are some companies that are repeated several times so the code that returns this error is this one
Code:
UPDATE CC_SPLIT SET CC_ACCOUNT_AMOUNT =
(SELECT AMOUNT FROM EXP_DATA
WHERE PERIOD = '1111'
AND EXP_DATA.ACCOUNT = CC_SPLIT.CC_ACCOUNT
AND EXP_DATA.ACCOUNT = CC_SPLIT.CC_COMPANY)
So I came with this as a solution but the problem is that the following only insert data in those companies that are repeated and have different ammounts
Code:
UPDATE CC_SPLIT SET CC_ACCOUNT_AMOUNT =
(SELECT SUM (AMOUNT) FROM EXP_DATA
WHERE PERIOD = '1111'
AND EXP_DATA.ACCOUNT = CC_SPLIT.CC_ACCOUNT
AND EXP_DATA.ACCOUNT = CC_SPLIT.CC_COMPANY)
So my question is how can I add into CC_ACCOUNT_AMOUNT the other data left?
Any ideas?
Thanks in advance