DaveJohnson
Technical User
Hi
Could anyone tell me where i am going wrong the first part works fine and updates existing records but the second half does not insert any new records.
UPDATE SY01200 SET
INET1 = (SELECT EMAIL FROM F100_VM_EMAIL WHERE SY01200.MASTER_ID = F100_VM_EMAIL.ACCOUNT),
INET8 = (SELECT NOTES FROM F100_VM_EMAIL WHERE SY01200.MASTER_ID = F100_VM_EMAIL.ACCOUNT)
FROM SY01200, F100_VM_EMAIL
WHERE SY01200.MASTER_ID IN (SELECT ACCOUNT FROM F100_VM_EMAIL) AND MASTER_TYPE = 'VEN'
INSERT INTO SY01200 (Master_Type, Master_ID, ADRSCODE, INETINFO, INET1, INET2, INET3, INET4, INET5, INET6, INET7, INET8)
SELECT 'VEN', F100_VM_Email.ACCOUNT, F100_VM_Email.ACCOUNT, ' ', F100_VM_Email.EMAIL, ' ', ' ', ' ', ' ', ' ', ' ', F100_VM_Email.NOTES
FROM SY01200, F100_VM_EMAIL
WHERE F100_VM_EMAIL.ACCOUNT NOT IN (SELECT MASTER_ID FROM SY01200)
Many Thanks
Could anyone tell me where i am going wrong the first part works fine and updates existing records but the second half does not insert any new records.
UPDATE SY01200 SET
INET1 = (SELECT EMAIL FROM F100_VM_EMAIL WHERE SY01200.MASTER_ID = F100_VM_EMAIL.ACCOUNT),
INET8 = (SELECT NOTES FROM F100_VM_EMAIL WHERE SY01200.MASTER_ID = F100_VM_EMAIL.ACCOUNT)
FROM SY01200, F100_VM_EMAIL
WHERE SY01200.MASTER_ID IN (SELECT ACCOUNT FROM F100_VM_EMAIL) AND MASTER_TYPE = 'VEN'
INSERT INTO SY01200 (Master_Type, Master_ID, ADRSCODE, INETINFO, INET1, INET2, INET3, INET4, INET5, INET6, INET7, INET8)
SELECT 'VEN', F100_VM_Email.ACCOUNT, F100_VM_Email.ACCOUNT, ' ', F100_VM_Email.EMAIL, ' ', ' ', ' ', ' ', ' ', ' ', F100_VM_Email.NOTES
FROM SY01200, F100_VM_EMAIL
WHERE F100_VM_EMAIL.ACCOUNT NOT IN (SELECT MASTER_ID FROM SY01200)
Many Thanks