MySQL Forums
Forum List  »  Newbie

Re: Reverse comma seperated field
Posted by: Peter Brawley
Date: August 23, 2017 10:03AM

An unfortunate illustration of why atomicity (one value per cell) is a fundamental RDBMS requirement.

Rather than script a repetition of that design error, consider projecting the column to the indexed child table where it belongs, ie create a table like items( parentid, idx, item ) where oarentid ties a group of items to the parent table PK, and use substring_index() to break out each comma-separated value to an ordinal idx and an item value; after that, you can easily manipulate the idx values to produce any desired ordering.

Options: ReplyQuote


Subject
Written By
Posted
Re: Reverse comma seperated field
August 23, 2017 10:03AM


Sorry, only registered users may post in this forum.

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.