Unanswered: A query that return alternatively values of a field
I have a table in postgresql database named Object with 3 fields ID, TYPE and DATE.
Infact, i need an sql query wich bring back values of the field of the field ‘TYPE’ which has the type list of strings , and at the same time I would like taht the query execute an alternative search on the list of strings wich is explained in an example as below :
An altrenative serach means that if I want the query to display the strings : ‘a’ and ‘b’ i have to fix it from the begining . after that while looping the list if I found the string ‘a’ , the last one would be displayed , and if I cotinue and I found it again it won’t be dispalyed or recovered if I didn’t yet find the string ‘b’ , and the query continue to recover the ‘a’ and ‘b’ so on until not finding the next ‘a’ or ‘b’ :
Example : if the field ‘TYPE’ has the value : ['a','a','b','c','a','b','b'] then the query return :
May be the functions 'regexp_replace' and 'intsr' would help ain’t ?
Thank you for your answers