Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BB1A7475921 for ; Tue, 3 Dec 2002 18:18:50 -0500 (EST) Received: from vader.guerrillabroadcasting.com (unknown [216.110.36.112]) by postgresql.org (Postfix) with ESMTP id D15FB476864 for ; Tue, 3 Dec 2002 18:16:46 -0500 (EST) Received: from clients.jacobstern.com (clients.jacobstern.com [207.13.228.2]) by vader.guerrillabroadcasting.com (8.11.6/8.11.6) with ESMTP id gB3NGmO13178 for ; Tue, 3 Dec 2002 17:16:48 -0600 Received: from no.name.available by clients.jacobstern.com via smtpd (for [216.110.36.112]) with ESMTP; Tue, 3 Dec 2002 15:16:48 -0800 User-Agent: Microsoft-Entourage/10.1.1.2418 Date: Tue, 03 Dec 2002 15:16:49 -0800 Subject: [OFFTOPIC] Query Help From: Hunter Hillegas To: PostgreSQL Message-ID: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/194 X-Sequence-Number: 34109 Someone asked me to create a query for them that would compute some averages for them over time. Basically I have a view that looks like this: sample_request_line_item_number | integer | sample_origin | character varying | date_of_request | timestamp with time zone | username | character varying | date_shipped | date | date_difference | double precision | I have a query that does what I need: select username, avg(date_difference) from sample_request_average_days where date_shipped between '2002-11-01' and '2002-11-30' group by username; Basically it is getting the average number of days it took to ship something by salesperson, by month. The problem is that I want it to print the results for each month for which there are entries (without hard-coding dates). Is there any easy way to do this that I'm missing? Any help appreciated. Please reply off-list to minimize noise. Thanks, Hunter