DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
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)




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links