Re: DONT_CARE Aggregate - Mailing list pgsql-general

From Richard Broersma
Subject Re: DONT_CARE Aggregate
Date
Msg-id CABvLTWES-rWJtUrOE+Y0k-3MSG6S59JyRyE5osrsHBPUkOB7ZQ@mail.gmail.com
Whole thread Raw
In response to Re: DONT_CARE Aggregate  (Robert James <srobertjames@gmail.com>)
Responses Re: DONT_CARE Aggregate  (Robert James <srobertjames@gmail.com>)
List pgsql-general
On Thu, Dec 20, 2012 at 5:45 AM, Robert James <srobertjames@gmail.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.

pgsql-general by date:

Previous
From: Vick Khera
Date:
Subject: Re: Any experience with Drobo SAN and PG?
Next
From: Robert James
Date:
Subject: Re: DONT_CARE Aggregate