By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

A query that return alternatively values of a field

P: 1
Hello,
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 wont be dispalyed or recovered if I didnt 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 :
['a','b','a','b']
May be the functions 'regexp_replace' and 'intsr' would help aint ?
Thank you for your answers 
Best regards 
Dec 8 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.