Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Tom Lane
Marti Raudsepp writes: > On Thu, Dec 20, 2012 at 3:28 AM, Robert James wrote: >> Is there an aggregate that will return an arbitrary instance? That is, >> not necessarily the max or min, just any one? (Which might perform >> better than max or min) >> >> More importantly: >> Is there one which w

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Marti Raudsepp
On Thu, Dec 20, 2012 at 3:28 AM, Robert James wrote: > Is there an aggregate that will return an arbitrary instance? That is, > not necessarily the max or min, just any one? (Which might perform > better than max or min) > > More importantly: > Is there one which will return an arbitrary instance

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Chris Curvey
On Thu, Dec 20, 2012 at 12:00 PM, Robert James wrote: > I see. What if I need to do this along with an Aggregate Query. Eg > something like: > > SELECT x,y,z, MAX(a), MAX(b), DONT_CARE_AS_LONG_AS_NOT_NULL(c), > DONT_CAR_AS_LONG_AS_P_IS_TRUE(d,p) > ... > GROUP BY x,y,z > > ah, I get what you're t

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Robert James
I see. What if I need to do this along with an Aggregate Query. Eg something like: SELECT x,y,z, MAX(a), MAX(b), DONT_CARE_AS_LONG_AS_NOT_NULL(c), DONT_CAR_AS_LONG_AS_P_IS_TRUE(d,p) ... GROUP BY x,y,z On 12/20/12, Richard Broersma wrote: > On Thu, Dec 20, 2012 at 5:45 AM, Robert James > wrote

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Richard Broersma
On Thu, Dec 20, 2012 at 5:45 AM, Robert James wrote: > Sergey - That's an interesting option, but I'm not sure how to use it > as an aggregate. Could you give an example? > Here is an example: buildinghac=> SELECT itemnbr, buildingnbr FROM Actionitems ORDER BY buildingnbr LIMIT 10; it

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Robert James
Sergey - That's an interesting option, but I'm not sure how to use it as an aggregate. Could you give an example? On 12/20/12, Sergey Konoplev wrote: > On Wed, Dec 19, 2012 at 5:28 PM, Robert James > wrote: >> And even better: >> An aggregate which will return the first instance that meets a ce

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Sergey Konoplev
On Wed, Dec 19, 2012 at 5:28 PM, Robert James wrote: > And even better: > An aggregate which will return the first instance that meets a certain > predicate? Take a look at DISTINCT ON. -- Sergey Konoplev Database and Software Architect http://www.linkedin.com/in/grayhemp Phones: USA +1 415 867