sooeydoo wrote:
> I have two rows - heading and body - in one table tiki_articles
Do you mean 'two columns'?
> While all rows have heading, only some have body. I want to combine those rows that have a body
> with their corresponding heading rows so that the result is one big heading row with both heading
> and body content in that order.
UPDATE tiki_articles SET heading = CONCAT(heading, 'some spacer', body)
WHERE body IS NOT NULL;
But be careful:
1) there is no way back
2) make sure the combined header/body fits in the header column, or truncation will occur.
It's probably best to try this first on a copy of the table, or to use ALTER TABLE to add another column and put the combined header/body in that column:
ALTER TABLE tiki_articles ADD COLUMN headingbody TEXT;
UPDATE tiki_articles SET headingbody = CONCAT(heading, 'some spacer', body)
WHERE body IS NOT NULL;
When everything is OK (no warnings) you can then remove the heading and body columns and rename the headingbody column back to heading (if that is what you want).
--
felix
Please use
BBCode to format your messages in this forum.