Re: [GENERAL] Searching array for multiple items

2017-01-25 Thread Andreas Joseph Krogh
På onsdag 25. januar 2017 kl. 09:47:56, skrev Thomas Kellerer < spam_ea...@gmx.net >: Alex Magnum schrieb am 25.01.2017 um 09:29: > I can search an array with 1 = ANY('{1,3,4,7}'::int[]) > > I need to check for one or multiple items in the array. > > e.g.'1,7,3'  = A

Re: [GENERAL] Searching array for multiple items

2017-01-25 Thread Thomas Kellerer
Alex Magnum schrieb am 25.01.2017 um 09:29: > I can search an array with 1 = ANY('{1,3,4,7}'::int[]) > > I need to check for one or multiple items in the array. > > e.g.'1,7,3' = ANY('{1,3,4,7}'::int[] > > I do need to check if > a) all items exist in the array You can use the contains (or is

Re: [GENERAL] Searching array for multiple items

2017-01-25 Thread Oleg Bartunov
On Wed, Jan 25, 2017 at 11:29 AM, Alex Magnum wrote: > Hi, > I can search an array with 1 = ANY('{1,3,4,7}'::int[]) > > I need to check for one or multiple items in the array. > > e.g. '1,7,3' = ANY('{1,3,4,7}'::int[] > > I do need to check if > a) all items exist in the array > b) at least one

[GENERAL] Searching array for multiple items

2017-01-25 Thread Alex Magnum
Hi, I can search an array with 1 = ANY('{1,3,4,7}'::int[]) I need to check for one or multiple items in the array. e.g. '1,7,3' = ANY('{1,3,4,7}'::int[] I do need to check if a) all items exist in the array b) at least one item exists in the array Is there a an operator that allows me to do th

Re: [GENERAL] Searching array fields - or should I redesign?

2010-12-16 Thread Vincent Veyron
Le jeudi 16 décembre 2010 à 15:18 -0500, Bryan Montgomery a écrit : > Thanks for the comments. Just to clarify, I gave these two values as > examples. The readings could be between a handful for one vehicle type > up to 40 or more for another type of vehicle. > Not sure what you call a reading? d

Re: [GENERAL] Searching array fields - or should I redesign?

2010-12-16 Thread Bryan Montgomery
Thanks for the comments. Just to clarify, I gave these two values as examples. The readings could be between a handful for one vehicle type up to 40 or more for another type of vehicle. On Thu, Dec 16, 2010 at 12:26 PM, Vincent Veyron wrote: > Le mercredi 15 décembre 2010 à 19:12 +0100, Jan Keste

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
Let me also say that I'm retarded. No excuses from me. I'm officially retarded. --- Matthew Peter <[EMAIL PROTECTED]> wrote: > Thanks. That syntax didn't look right to find values > gte 1. But thanks everyone! > > > > --- Tom Lane <[EMAIL PROTECTED]> wrote: > > > Matthew Peter <[EMAIL P

Re: [GENERAL] searching array

2005-10-17 Thread Tom Lane
Matthew Peter <[EMAIL PROTECTED]> writes: > Yes. I did read it wrong. I wanted to find all records > that contained x where x >= 1 Then flip it around: contain x where 1 <= x 1 <= ANY (array) For syntactic reasons, there's no "ANY(array) >= x" construct, so you have

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
I have it backwards huh? Since the variables are switched around in a ANY search I want a SELECT * FROM table WHERE arrcol >= 1 How do I write it to get those results? --- Tom Lane <[EMAIL PROTECTED]> wrote: > Matthew Peter <[EMAIL PROTECTED]> writes: > > Shouldn't >= also return Carols r

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
Yes. I did read it wrong. I wanted to find all records that contained x where x >= 1 I am using ANY in my query on my test box I copied the ALL from example query in the docs, which still isn't working for me. --- Tom Lane <[EMAIL PROTECTED]> wrote: > Matthew Peter <[EMAIL PROTECTED]> writes

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
Thanks. That syntax didn't look right to find values gte 1. But thanks everyone! --- Tom Lane <[EMAIL PROTECTED]> wrote: > Matthew Peter <[EMAIL PROTECTED]> writes: > > Yes. I did read it wrong. I wanted to find all > records > > that contained x where x >= 1 > > Then flip it around: >

Re: [GENERAL] searching array

2005-10-17 Thread Stephan Szabo
On Mon, 17 Oct 2005, Matthew Peter wrote: > Thanks for the reply. I'm using 8.0.3. I'm using > something similiar to the example you gave. My > postgresql install is on offline developement box and > I would have to type it all out longhand. > > Shouldn't >= also return Carols records since she >

Re: [GENERAL] searching array

2005-10-17 Thread Tom Lane
Matthew Peter <[EMAIL PROTECTED]> writes: > Shouldn't >= also return Carols records since she > contains records GREATER THAN 1? You seem to be reading the construct backwards. x >= ALL (array) is true if x >= every member of the array. This is clearly false for x = 1 and array

Re: [GENERAL] searching array

2005-10-17 Thread Joe Conway
Matthew Peter wrote: Shouldn't >= also return Carols records since she contains records GREATER THAN 1? This is the problem I'm having, there's no errors, just no records matching the > (gt) part. Only exact matches. Look again at your query: SELECT * FROM sal_emp WHERE 1 >= ALL (pay_b

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
Alright, what about with ANY? --- Joe Conway <[EMAIL PROTECTED]> wrote: > Matthew Peter wrote: > > Shouldn't >= also return Carols records since she > > contains records GREATER THAN 1? This is the > > problem I'm having, there's no errors, just no > records > > matching the > (gt) part. Only

Re: [GENERAL] searching array

2005-10-17 Thread Matthew Peter
Thanks for the reply. I'm using 8.0.3. I'm using something similiar to the example you gave. My postgresql install is on offline developement box and I would have to type it all out longhand. Shouldn't >= also return Carols records since she contains records GREATER THAN 1? This is the proble

Re: [GENERAL] searching array

2005-10-16 Thread Tom Lane
Matthew Peter <[EMAIL PROTECTED]> writes: > I was trying to search a array with a GTE to value and > it doesn't work. Is this supported? Or am I missing > something? > SELECT * FROM sal_emp WHERE 1 >= ALL (pay_by_quarter); Define "doesn't work". Do you get an error --- if so, what exactly? D

Re: [GENERAL] searching array

2005-10-16 Thread Joe Conway
Matthew Peter wrote: I was trying to search a array with a GTE to value and it doesn't work. Is this supported? Or am I missing something? SELECT * FROM sal_emp WHERE 1 >= ALL (pay_by_quarter); Works for me: CREATE TABLE sal_emp ( name text, pay_by_quarter integer[], schedule text[][]

[GENERAL] searching array

2005-10-16 Thread Matthew Peter
I was trying to search a array with a GTE to value and it doesn't work. Is this supported? Or am I missing something? SELECT * FROM sal_emp WHERE 1 >= ALL (pay_by_quarter); __ Yahoo! Music Unlimited Access over 1 million songs. Try it free.