Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Sergey Konoplev
On Wed, Dec 19, 2012 at 5:28 PM, Robert James srobertja...@gmail.com 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

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 gray...@gmail.com wrote: On Wed, Dec 19, 2012 at 5:28 PM, Robert James srobertja...@gmail.com wrote: And even better: An aggregate which will return

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Richard Broersma
On Thu, Dec 20, 2012 at 5:45 AM, Robert James srobertja...@gmail.comwrote: 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

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 richard.broer...@gmail.com wrote: On Thu, Dec 20, 2012 at

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Chris Curvey
On Thu, Dec 20, 2012 at 12:00 PM, Robert James srobertja...@gmail.comwrote: 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

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Marti Raudsepp
On Thu, Dec 20, 2012 at 3:28 AM, Robert James srobertja...@gmail.com 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

Re: [GENERAL] DONT_CARE Aggregate

2012-12-20 Thread Tom Lane
Marti Raudsepp ma...@juffo.org writes: On Thu, Dec 20, 2012 at 3:28 AM, Robert James srobertja...@gmail.com 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