Re: Some insight on the proper SQL would be appreciated - Mailing list pgsql-general

From Harald Fuchs
Subject Re: Some insight on the proper SQL would be appreciated
Date
Msg-id puk4q875ey.fsf@srv.protecting.net
Whole thread Raw
In response to Some insight on the proper SQL would be appreciated  (Aaron Burnett <aburnett@bzzagent.com>)
List pgsql-general
In article <4C0F4BA8.3040805@gmail.com>,
Ognjen Blagojevic <ognjen.d.blagojevic@gmail.com> writes:

> Plenty of solutions here:
> http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/

This doesn't mention the incredibly powerful windowing functions of
PostgreSQL >= 8.4.0:

  SELECT username, firstname, lastname, signedup
  FROM (
      SELECT username, firstname, lastname, signedup,
             row_number() OVER (PARTITION BY username ORDER BY signedup)
      FROM mytbl
    ) dummy
  WHERE row_number <= 5

pgsql-general by date:

Previous
From: "Massa, Harald Armin"
Date:
Subject: Windows: Compiling and linking dynamically-loaded functions
Next
From: Bill Moran
Date:
Subject: Locale, LL_COLLATE and sorting case-insensatively