My table consists of records where every record has its own history which looks like this:
65465406540-245|65465408540-654
There is no limitation to history entries count (column type is text, so ...). And history entries are ALWAYS sorted from the oldest to the newest. Meaning the newest entry is on the right.
History entries are separated by pipe char "|". One history entry consists of timestamp, dash "-" as a separator and 1-4 digit number which represents user ID who made the change.
Now my problem is I'd like to sort records in my table by the most recent (or the oldest) history entry. How would I do that?
I was thinking about MySQL functions, since result has to come to my PHP script already sorted, but I don't know where to start, so every help is much appreciated.