Jump to content

Reverse order of items in a row?


SEVIZ

Recommended Posts

I have a row in my table with peoples names.  Right now it is last name first and then first name.  Is there a query I could run to reverse these two words in all the rows?

 

Currently looks like this:

Murphy Peter

Kovac Walter

 

Want it to be:

Peter Murphy

Walter Kovac

 

Thanks for any ideas.

Link to comment
https://forums.phpfreaks.com/topic/158056-reverse-order-of-items-in-a-row/
Share on other sites

Well, you'll still end up using those 3 functions in the SQL unless you plan to do it the heavy way by using PHP. Create 2 columns - one for first name and one for last name. Then use an UPDATE SQL query.

 

Look here on how those 3 functions are used - http://dev.mysql.com/doc/refman/5.1/en/string-functions.html

 

I'm pretty sure a similar case came up using those 3 functions. If you really want and have the time, traverse a few pages in this forum and see if you can find that topic. But it's probably not too hard. Give it a try. =)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.