homepage Welcome to WebmasterWorld Guest from 54.167.207.16
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
MySql Query Help
jsprague




msg:4284117
 12:31 pm on Mar 19, 2011 (gmt 0)

Hello,

I am hoping somebody can tell me how to run a query I am trying to do. First, an example of the table.

-----------------------------
QID SetID Objective
-----------------------------
1......1......Spanning Tree protocols
2......5......blah blah blah
3......1......Spanning Tree protocols
4......3......Spanning Tree protocols

I have been using the following command successfully to replace Objective titles:

update questions set objective = replace(objective,'Conduct the operation of Spanning Tree protocols in a hierarchical network','Conduct the operation of Spanning Tree protocols')

Now, I need be able to replace instances of an objective with a particular SetID only. So in the example table above, I want to change Spanning Tree Protocols with a SetID of 1 only and not affect setid 3.

I tried the following, but it gave and error.

update questions where SetID="1" set objective = replace(objective,'Conduct the operation of Spanning Tree protocols in a hierarchical network','Conduct the operation of Spanning Tree protocols')

Many thanks!

 

topr8




msg:4284526
 12:06 pm on Mar 20, 2011 (gmt 0)

update questions set objective = 'text here that you want' where SetID="1" ;

jsprague




msg:4284853
 1:00 am on Mar 21, 2011 (gmt 0)

Many thanks. That worked perfectly!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved