Results 1 to 4 of 4

Thread: sql 'UPDATE' statement question

  1. #1

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935

    sql 'UPDATE' statement question

    Hey all.

    I working with a sql database. I have to Tables that contain data on a customer. I am using a left outer join query to retrieve and view a complete data set on the customer. My question is when Iam modifying customer details in some instances i need to update information in both tables. Is there a syntax for doing this at the same time eg

    UPDATE MYTABLE LEFT OUTER JOIN MYOTHERTABLE SET BLAH, BLAH WHERE BLAHBLAH = 'BLEH'

    would a statement like that work?

    I have tried it and get errors I cant seem to find any documentation on doing joined table updates

    any help would be appreciated thanks

  2. #2
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    There is no single query that I'm aware of to update 2 tables in one hit. But what you can do, is set up relationships in the tables, and set them to cascade updates. In Access, this is pretty straightforward, I can't speak for any other system though, and it only works for related fields.

    Depending on what you need, you may just need 2 queries.
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  3. #3

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    ahhhh

    I thought that might be the case. Dang it all lol

    This means i have to spend a few more hours making all my update procedures recursive to step through the multiple tables

    Iam working with more than 50 linked tables so I was living in hope a bit there.

  4. #4
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    Would the cascade option help? What are you trying to achieve - illustrate with some example perhaps?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

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