Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    45

    Unanswered: update query problem

    hallo,
    I'm trying to update a table depending on the content of another table. The two involved tables have a column that will be compared and if the value match, a value of another column will be copied from another table to the other.
    To simplify it:
    1) tbl_source (Sou_orgID and Sou_langID)
    2) tbl_taget (Tar_orgID and Tar_langID)

    if sou_orgID and tar_orgID are the same then tar_langID is updated and becomes = sou_langID.

    The sql code I tried is this:

    UPDATE xtbl_target SET Tar_langID = ( SELECT xtbl_Source.sou_langID
    FROM xtbl_Source
    WHERE xtbl_Source.Sou_orgID = xtbl_target.Tar_orgID)
    WHERE EXISTS
    ( SELECT Sou_langID
    FROM xtbl_Source
    WHERE xtbl_source.Sou_orgID = xtbl_Target.Tar_OrgID);

    but it tells me: "operation must use a updatebale query", does someone have a clue?
    thanks

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Update tbl_target tt
    INNER JOIN
    tbl_source ts ON
    tt.Tar_orgID = ts.Sou_orgID
    Set tt.Tar_langID = ts.Sou_langID
    Last edited by r123456; 07-19-04 at 10:21.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Feb 2004
    Posts
    45
    thanks r12345. it worked fine

Posting Permissions

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