I have a field in the Client table called "Attachment Name" which has the names of every attachment that a client has, the way the names are saved are the following, it alwas starts with a “^” character, then the name of the file, when you have to save another file the same character is placed.
So for example, in client number 1423 we have "^file1^userGuide^file3"
, in this case we have 3 files, File1, userGuide and File3.
What i need is a way to know the clients that have only ONE file attached, or the ones that have more than one file.
I know this is an awfull way to store file names, but i did not do it this way and its not my call to change it.
I have been working with this sentence:
Select regexp_split_to_array("attachment_name", E'\\^+') from clients
But i could not make it work at all.
Copyright Notice:Content Author:「gsanchez92」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40611137/how-to-separate-and-count-string-from-text-column-postgresql