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.