Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update

Status
Not open for further replies.
Oct 17, 2006
227
Forgive me for being stupid

Update d_temp
set order_flag = '1' where brand_id = 'J'
set order_flag = '2' where brand_id = 'P'
set order_flag = '3' where brand_id = 'R'


Am i missing something???
 
You can only have 1 set for each update, so you could do it like this...

Code:
Update d_temp
set order_flag = '1' where brand_id = 'J'

Update d_temp
set order_flag = '2' where brand_id = 'P'

Update d_temp
set order_flag = '3' where brand_id = 'R'

You could also try...

Code:
Update d_temp
set order_flag = Case When brand_id = 'J' Then '1' 
                      When brand_id = 'P' Then '2'
                      When brand_id = 'R' Then '3'
                 End
Where brand_id In ('J','P','R')

As always, with an update statement, you should probably create a backup before trying it.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top