N-tile function in postgres - Mailing list pgsql-general

From Rachel Owsley
Subject N-tile function in postgres
Date
Msg-id 81F2AED71E996746829AC866496B2EA373EC57EBFC@MAIL-NASH01.edo.local
Whole thread Raw
Responses Re: N-tile function in postgres  (François Beausoleil <francois@teksol.info>)
List 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

pgsql-general by date:

Previous
From: Bosco Rama
Date:
Subject: Re: Prolem to acess PostgeSQL from other mechine
Next
From: François Beausoleil
Date:
Subject: Re: N-tile function in postgres