MySQL Forums
Forum List  »  Newbie

Copying just a short part of one field to another when the field is blank
Posted by: Lara
Date: April 14, 2005 08:06PM

Okay, so I'm definitely a newbie, but hopefully will be able to explain my question in a way that will be understood by all.

I've recently imported about 2000 entries into a weblog (htpp://www.withinwithout.org) that uses mySQL as its database. Many of the entries did not have "titles" (post_title), but in the new system I'm using the titles are necessary for full functionality.

What I would love to be able to do is copy a truncated version of the post content (post_content) into the title (post_title) for any instance where the title is currently missing. I'm okay with just a certain number of characters as opposed to needing full words. My biggest concern is just getting SOMETHING meaningful into that column for each entry so that the rest of the system will work together.

I think I need to run something like this:

UPDATE wp_posts SET post_title = post_content WHERE post_title = '';

but I don't know how to only copy a small part of the post_content.

I access the database through phpMySQL.

Any help would be appreciated.


Thanks,
Lara

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.