Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Location
    Toronto, Ontario, Canada
    Posts
    34

    Question Unanswered: updating rows from another table

    Hi all

    Here is my situation. I have rows in a column in that are null(lets call this column A in table A) I have another table that has values I would like to populate the null values with(column A table B). All the rows in column A in table B will be used to populate the null values in Column A in table A however there are more null values that I will not be updating in Table A. Table A and Table B and related by column C. Can anyone show me how I can populate the values in column A in table A with all the values in column A in table B?

    Thanks

    Hamza

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: updating rows from another table

    update a
    set a.a = (select b.a from b where b.c = a.c)
    where a.c in (select b.c from b);

  3. #3
    Join Date
    Feb 2003
    Location
    Toronto, Ontario, Canada
    Posts
    34

    Smile Re: updating rows from another table

    I just tried your statement and it worked perfectly thanks Tony!


    Originally posted by andrewst
    update a
    set a.a = (select b.a from b where b.c = a.c)
    where a.c in (select b.c from b);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •