| | |
Multiline Update
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 106
Reputation:
Solved Threads: 5
Hello all.
I have a small db, that has news.
I want to update the field "content" to add the phraze "<br>Aproved by Admin" for every row in the database.
A better explanation, i have table news, with 1 table that is defined : create table news (id int, creator char(10), content char(255));
and for example i have 2 rows:
i want to update all the values of the content be current content+"<br>Aproved by Admin"
How can i do that ?
Thanks in advance.
I have a small db, that has news.
I want to update the field "content" to add the phraze "<br>Aproved by Admin" for every row in the database.
A better explanation, i have table news, with 1 table that is defined : create table news (id int, creator char(10), content char(255));
and for example i have 2 rows:
sql Syntax (Toggle Plain Text)
INSERT INTO news VALUES (1,"admin","test1"); INSERT INTO news VALUES (1,"nonadmin","test2");
How can i do that ?
Thanks in advance.
Last edited by peter_budo; Sep 13th, 2009 at 5:53 am. Reason: K
•
•
Join Date: Jun 2008
Posts: 79
Reputation:
Solved Threads: 8
Try this :
•
•
•
•
update news set content=concat(content,' <br>Aproved by Admin');
:- Varma
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
•
•
Join Date: Sep 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Hello all.
I want to update the field "content" to add the phraze "<br>Aproved by Admin" for every row in the database.
How can i do that ?
Thanks in advance.
You don't say what database you're using, but you would want string concatenate functions. Assuming MySQL your query would be:
UPDATE news SET content = concat(content, '<br> Approved by Admin'
And that's it. Keep in mind that with no qualifiers (i.e. "WHERE category = 'approved'" or whatever) it will update *all* fields. If that's what you want, you're done.
This is my first post here. If I get formatting wrong I apologize.
![]() |
Similar Threads
- DataAdapter.Update in C# to MS-Access does not update Multiline Text Box Memo Fields (C#)
- Problem with Windows Update and WinXP (Web Browsers)
- MultiLine TextBoxes in GridView edit mode (ASP.NET)
- News Story: PS3 firmware update on its way, admits PlayStation bigwig (Mac Rumors and Reports)
- Error 624: The system could not update the phone book file (Windows NT / 2000 / XP)
- Placing a Multiline textbox over a datagrid (VB.NET)
- can't update window because of active x (Windows NT / 2000 / XP)
- Auto update columns? (Database Design)
Other Threads in the MySQL Forum
- Previous Thread: MySQL Date Problem
- Next Thread: lookup table
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm database design developer development distinct dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





