Update query


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Update query

  1. #1
    Andy Guest

    Update query


    Hi,
    Can anyone tell if the following update query looks just about right?

    UPDATE [AC Case] SET [AC Case].Magistrate_ID = 6
    WHERE [AC Case].[Case_ID]=22 And [AC Case].[Case_ID]=23;

    The table name is AC Case
    The field that I want to update is called Magistrate_ID
    And I just want to update the magistrate_ID in cases 22 and 23.

    Cheers
    Andy


  2. #2
    G. Allen Guest

    Re: Update query


    I think you want to say OR rather than AND in the WHERE clause. The Case_ID
    field in a record can't be both 22 and 23 at the same time.

    "Andy" <andrew.constable@ntlworld.com> wrote:
    >
    >Hi,
    >Can anyone tell if the following update query looks just about right?
    >
    >UPDATE [AC Case] SET [AC Case].Magistrate_ID = 6
    >WHERE [AC Case].[Case_ID]=22 And [AC Case].[Case_ID]=23;
    >
    >The table name is AC Case
    >The field that I want to update is called Magistrate_ID
    >And I just want to update the magistrate_ID in cases 22 and 23.
    >
    >Cheers
    >Andy
    >



  3. #3
    Drake Guest

    Re: Update query




    Looks good Andy.. try this

    UPDATE [AC Case]
    SET [AC Case].Magistrate_ID = 6
    WHERE [AC Case].[Case_ID] in (22,23)




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center