N-tile function in postgres

From: Rachel Owsley <Rachel(dot)Owsley(at)edointeractive(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: N-tile function in postgres
Date: 2012-09-24 16:32:25
Message-ID: 81F2AED71E996746829AC866496B2EA373EC57EBFC@MAIL-NASH01.edo.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Can anyone help me with an aggregate query I am having trouble with?

I want to get the top 5 or top 10 most frequently shopped in merchant categories for each account holder at a bank and put each of the quintiles/deciles into separate columns. I would also like to put the average transaction amount for each of those top 5-10 categories into separate columns, and the date of the last transaction in each of those 5 to 10 categories into separate columns. I am told that ntile may be an option for doing this, but can't find any examples for using it in the documentation.

We use Postgresql 9.1.

Thank you so much for your help.

Rachel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message François Beausoleil 2012-09-24 17:57:16 Re: N-tile function in postgres
Previous Message Bosco Rama 2012-09-24 16:24:53 Re: Prolem to acess PostgeSQL from other mechine