[GENERAL] N-tile function in postgres

2012-09-24 Thread Rachel Owsley
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

Re: [GENERAL] N-tile function in postgres

2012-09-24 Thread François Beausoleil
Le 2012-09-24 à 12:32, Rachel Owsley a écrit : 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

Re: [GENERAL] N-tile function in postgres

2012-09-24 Thread Rachel Owsley
: François Beausoleil [mailto:franc...@teksol.info] Sent: Monday, September 24, 2012 12:57 PM To: Rachel Owsley Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] N-tile function in postgres Le 2012-09-24 à 12:32, Rachel Owsley a écrit : Hi, Can anyone help me with an aggregate query I am

Re: [GENERAL] N-tile function in postgres

2012-09-24 Thread François Beausoleil
Le 2012-09-24 à 14:12, Rachel Owsley a écrit : Thank you, François! This is very helpful! I’ll give this query a try. I don’t know the cross-tab function, but that’s exactly what I want to do for the column output. Regarding the sample query, I see the min (amount), but how is the upper

Re: [GENERAL] N-tile function in postgres

2012-09-24 Thread Rachel Owsley
Thank you, François!! Got it. :) From: François Beausoleil [mailto:franc...@teksol.info] Sent: Monday, September 24, 2012 3:37 PM To: Rachel Owsley Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] N-tile function in postgres Le 2012-09-24 à 14:12, Rachel Owsley a écrit : Thank you