From: | Robert James <srobertjames(at)gmail(dot)com> |
---|---|
To: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
Cc: | Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: DONT_CARE Aggregate |
Date: | 2012-12-20 17:00:13 |
Message-ID: | CAGYyBgiV6HyAMC1LNBMxchYGJoqUO5UYwyqb14RYcPLfo9botg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)broersma(at)gmail(dot)com> wrote:
> On Thu, Dec 20, 2012 at 5:45 AM, Robert James
> <srobertjames(at)gmail(dot)com>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;
> itemnbr | buildingnbr
> ---------+-------------
> 1181 | B-0106
> 363 | B-0106
> 185 | B-0106
> 483 | B-0106
> 67 | B-0106
> 125 | B-0106
> 303 | B-0106
> 245 | B-0106
> 68 | B-0107
> 304 | B-0107
> (10 rows)
>
>
> buildinghac=>
>
> SELECT DISTINCT ON ( buildingnbr )
> itemnbr, buildingnbr
> FROM Actionitems
> ORDER BY buildingnbr
> LIMIT 10;
> itemnbr | buildingnbr
> ---------+-------------
> 245 | B-0106
> 364 | B-0107
> 1170 | B-0111
> 361 | B-0112
> 128 | B-0116
> 1013 | B-0117
> 129 | B-0118
> 368 | B-0300
> 1141 | B-0307
> 74 | B-0423
> (10 rows)
>
>
> --
> Regards,
> Richard Broersma Jr.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Curvey | 2012-12-20 17:11:26 | Re: DONT_CARE Aggregate |
Previous Message | Tom Lane | 2012-12-20 16:08:58 | Re: [GENERAL] trouble with pg_upgrade 9.0 -> 9.1 |