Question

  Asked: Apr 29 2008   11:03 AM GMT
  Asked by: Mr.


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


Update, SELECT statement, SQL

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

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



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))
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Microsoft Windows, Database and Development.

Looking for relevant Microsoft Windows Whitepapers? Visit the SearchWinIT.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register