How to find out top 3 records in each location - Mailing list pgsql-sql

From wen tseng
Subject How to find out top 3 records in each location
Date
Msg-id 00e001c70cc6$926292a0$6f0aa8c0@miswen
Whole thread Raw
Responses Re: How to find out top 3 records in each location
Re: How to find out top 3 records in each location
List pgsql-sql
On PostgreSQL, I have a table like this:
 
Item     Location    Sales
 A            X             10
 B            X              6
 C            Y              3
 D            Y              8
 E            Y              15
 F            Y             11
 
I'd like to find out top 3 items in each location and put those 3 items as colum values like this:
 
Location    Top1   Top2   Top3
  X              A        B
  Y             E         F        D
 
Since PostgreSQL doesn't support TOP, how can I do to get this result?
Any solution will be appreciated.
 
Thank you in advance.

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: tsvector_eq appears to be inconsistent.
Next
From: Andrew Sullivan
Date:
Subject: Re: How to find out top 3 records in each location