Results 1 to 6 of 6

Thread: table checking

  1. #1
    Join Date
    Jan 2004
    Location
    dubai
    Posts
    2

    Unanswered: table checking

    I need to check one table while updating another table
    suppose i need to check table1's value is whether less then 0 or not
    without if condition can i check it with update query?
    thank you

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    You can use a subquery. Please be more specific.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You mean...

    I want to make sure there's a Parent row before I insert a child...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jan 2004
    Posts
    2

    Re: table checking

    Do u want to check through the front end or r u doing this job in the back end. Be specific in ur query

  5. #5
    Join Date
    Oct 2003
    Posts
    706

    Lightbulb

    Usually this is done with two or more queries in a transaction. (Not one improbable query.)

    In a situation like this, you want to perform a series of queries (with stable results that won't change a nano-sec later), and a series of inserts or updates, as "one atomic unit of work such that everything happens or nothing at all." That's the textbook definition of a transaction and I think this is the key to making it work for you.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You should be able to easily accomplish this in a single query.

    Update table 1 blahblahblah...
    where (select value from table1) <0

    If you need to check multiple associated records in table1 then you do the same thing, but with a join.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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