Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006

    Unanswered: How to update a column?

    I have a tableA with 15 columns, i created tableB with 4columns form tableA, now i need 1 more column from tableA, so i updated the table with that new column.
    now i want the data present in that column in tableA to be added in tableB. can any one pl help me in updating the data only for that particular column. (Already there are some 10,000) records in tableB in the remaining 4columns and that data is linked with some other tables, so i cant delete the data).
    Pl help me out..Thanks in advance

  2. #2
    Join Date
    Oct 2006
    Hello !!
    If I understand you correct you should be able to do like this:

    update tableB tB
    set tB.col5 = (select tA.col5 from tableA tA where tA.col1 = tB.col1);
    tA.col5 is the column that you added from tableA to tableB.
    tA.col1 and tB.col1 are columns that are the same and keys in both tables.

    Hope it works out for you!!
    Best regards

  3. #3
    Join Date
    May 2004
    Dominican Republic
    Yarmilkwes, that will work wonders IF and ONLY IF, col1 is unique in tableA, otherwise I see you getting ORA-01427 on that.

    ppavan21, is there any uniqueness between the four columns you copied to tableb ?

  4. #4
    Join Date
    Sep 2006
    Thank you for ur quick worked, once again thank u for ur help

Posting Permissions

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