Results 1 to 2 of 2

Thread: To replace selected records in a field based on condition of another field

  1. #1
    Join Date
    Jun 2008
    Posts
    10

    To replace selected records in a field based on condition of another field

    Hi,

    Please can anyone provide an SQL syntax:

    To replace selected records in a field based on condition of another field. For example,
    Two fields a and b. 'a' field has three records, 1,2,3. b field has x,y and z. I like to replace all records '2' in field a if
    field b is x with value 5

    Thanks.
    Nijojo.

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Are they in same table? If so, try this:

    update table set a = 5 where a = 2 and b = 'x'

Posting Permissions

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