www.webdeveloper.com
Results 1 to 2 of 2

Thread: multiply row and condition update (Same table)

  1. #1
    Join Date
    Feb 2009
    Posts
    14

    multiply row and condition update (Same table)

    Hi

    I need to update more than 1 row with different condition (where clause) per row in the same table (SQL Server).

    something like this:
    Code:
    UPDATE mytable SET name='josh' WHERE id='1' and lastName='watergate'
    
    UPDATE mytable SET name='bob' WHERE id='2' and lastName='bluegun'

    I want to merge those 2 statements into 1.
    how can I do that in a most effective way ?

    thanks

  2. #2
    Join Date
    Dec 2005
    Location
    India
    Posts
    490
    Update the same column with different values when the conditions are different. Better to have separate statements.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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



Recent Articles