update a field from a file with a field from a selection from two files

70 pts.
Tags:
SELECT statement
SQL
Update
Hi! When I try this: update fileD d set d.value = (select c.value from (select b.key, b.value from fileB b where b.key not in (select a.key from fileA a)) c where d.key = c.key) I get the message "Null values not allowed in column or variable VALUE." on the other hand, when I do this selection: (select c.value from (select b.key, b.value from fileB b where b.key not in (select a.key from fileA a)) c) I get 46 records (value). Any hint...? Thanks in advance. Eduardo

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi again!

I already have the answer (I’ll just use the real files and fields). Goes like this:

update FCONTF A set VALCOM = (select sum(CMCOMI) from FMCM000FEN
where CMNDOS = A.CONCON and CMNDOS not in (select CMNDOS from FMCM000F) group by CMNDOS)
where exists (select distinct CMNDOS from FMCM000FEN
where CMNDOS = A.CONCON and CMNDOS not in (select CMNDOS from FMCM000F))

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following