I have a string in a column in mysql as follows:
761696495 - 689552180|723146573 - 684706476|295453556 - 656883782
Is there a way that I can check against that string, for example lets say I want to look either for 723146573 or 684706476, which is the middle item in the delimited piped string, I want to be able to return the whole portion of that string if a match is made. So for example if I wanted to check against 684706476, it would return:
723146573 - 684706476
And as the reverse, if I want to match 723146573, it would return the full match in that position too
723146573 - 684706476
Also just to not make any confusion, essentially I want to be able to match against this whole string for any position of it and if a hit is made it returns the first part of the - and last in that position it is found, hopefully that makes sense.
[:<:]723146573[:>:]. Then write a stored function that takes the whole column and the search string, loops over the pipe-delimited substrings, and returns the substring that contains the seach string.