update 2 tables
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: update 2 tables

  1. #1
    Join Date
    Aug 2002
    Posts
    115

    update 2 tables

    I have a sql file with 2 update queries

    UPDATE a
    set a.code='C'
    WHERE a.seqno IN (SELECT a.seqno FROM a,b WHERE a.code=' ' AND b.code2='D');

    UPDATE b
    set b.code2='C'
    WHERE b.seqno IN (SELECT b.seqno FROM a,b WHERE a.code=' ' AND b.code2='D');

    as you can see, the 1st update results in no rows bewing updated in the 1nd query as a.code is updated to 'C' by the 1st update.

    Is there anyway we can run the 1st update and then run the 2nd update with the snapshot of the data before the 1st update?

    We have to run both update in a single sql file.

    Thanks
    Sam

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,136
    I don't see join between a and b.

    SELECT a.seqno FROM a,b WHERE a.code=' ' AND b.code2='D'

    Tamil

Posting Permissions

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



Click Here to Expand Forum to Full Width