Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    144

    Question Unanswered: Update with Inner Join in DB2 for AS400

    Hello

    The following sentence does not run, is there an alternative way to achieve and Update using an Inner Join?

    Thanks a lot.

    update ECFORCLI.FCSTAAAA
    set
    FCU01A = ECFORCLI.FCSTAAAATM.FCU01A
    from ECFORCLI.FCSTAAAA
    inner join ECFORCLI.FCSTAAAATM on
    ECFORCLI.FCSTAAAATM.FCANO = ECFORCLI.FCSTAAAA.FCANO and
    ECFORCLI.FCSTAAAATM.FCSTOC = ECFORCLI.FCSTAAAA.FCSTOC

  2. #2
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,

    update ECFORCLI.FCSTAAAA
    set
    FCU01A = ECFORCLI.FCSTAAAATM.FCU01A
    from ECFORCLI.FCSTAAAA AS T1
    where
    (ECFORCLI.FCSTAAAATM.FCANO, ECFORCLI.FCSTAAAATM.FCSTOC)
    in
    (
    select ECFORCLI.FCSTAAAA.FCSTOC, ECFORCLI.FCSTAAAA.FCANO from ECFORCLI.FCSTAAAA where
    T1.FCANO = ECFORCLI.FCSTAAAA.FCANO and
    T1.FCSTOC = ECFORCLI.FCSTAAAA.FCSTOC
    )

    I hope I didn't mistype table names. Please in the future use more simple names for example on forum.

    Hope this helps,
    Grofaty

Posting Permissions

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