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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine multiple UPDATE statements

Status
Not open for further replies.

chillay

Programmer
Jun 27, 2002
102
US
Hello

Is there a way to combine the following 3 UPDATE statements to avoid executing each statement one-by-one?

UPDATE ServicePlans
SET PlanName = 'Long Distance (In/Out of State/Country)'
WHERE PlanName = 'Long Distance A';

UPDATE ServicePlans
SET PlanName = 'Long Distance (Limited States)'
WHERE PlanName = 'Long Distance B';

UPDATE ServicePlans
SET PlanName= 'Long Distance (In/Out State)'
WHERE PlanName = 'Long Distance C';

Thank you
 
And what wrong with 3 statements ?
Anyway:
UPDATE ServicePlans
SET PlanName = IIf(PlanName = 'Long Distance A','Long Distance (In/Out of State/Country)',IIf(PlanName = 'Long Distance B','Long Distance (Limited States)','Long Distance (In/Out State)'))
WHERE PlanName = IN ('Long Distance A','Long Distance B','Long Distance C');

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you guys. You are always so helpful.

Chillay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top