Posts: 3,176
Name: Thierry
Location: I'm the uber Spaminator !
|
It depends of the db you use, but guessing it's mysql, use the concat() function:
Code:
drop table test;
create table test( name varchar(20), description varchar(100));
insert into test values ('item 1','<p> blah');
insert into test values ('item 2','<p>Filler content');
insert into test values ('item 3','<p>Text text');
insert into test values ('item 4','<p>More random');
select * from test;
update test
set description=concat(name,' ',description)
select * from test;
which result into:
Code:
mysql> select * from test;
+--------+--------------------------+
| name | description |
+--------+--------------------------+
| item 1 | item 1 <p> blah |
| item 2 | item 2 <p>Filler content |
| item 3 | item 3 <p>Text text |
| item 4 | item 4 <p>More random |
+--------+--------------------------+
4 rows in set (0.00 sec)
For postgresql (and I think oracle too, but I have no oracle instance to test), for example, the command would be
Code:
update test
set description=name||' '||description;
and for ms sql server, it would be
Code:
update test
set description=name+' '+description;
__________________
Only a biker knows why a dog sticks his head out the window.
Last edited by tripy; 09-30-2009 at 03:23 AM..
|