X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2C973B439BB for ; Thu, 3 Jul 2003 15:32:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 19042-01 for ; Thu, 3 Jul 2003 12:32:31 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 51BA6B439B9 for ; Thu, 3 Jul 2003 12:32:30 -0300 (ADT) Received: (qmail 21946 invoked by uid 500); 3 Jul 2003 15:36:13 -0000 Date: Thu, 3 Jul 2003 10:36:13 -0500 From: Bruno Wolff III To: Michael Hanna Cc: pgsql-php@postgresql.org Subject: Re: query, display questions Message-ID: <20030703153613.GA21908@wolff.to> Mail-Followup-To: Michael Hanna , pgsql-php@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/12 X-Sequence-Number: 2124 On Thu, Jul 03, 2003 at 11:19:14 -0400, Michael Hanna wrote: > > Often there are multiple entries per day. I want to display the day > once, with all the entries on that day. > > So do I select * from notes and group by date, then write a nested > for-loop in php that ignores the extra timestamp items? Seems a little > inelegant. Or can I select distinct timestamps somehow after converting > them to dates? I think the normal thing to do here is have the application check that the date for the current row is the same as for the previous row and suppress the date in that case. If the repeated information was large enough that just transferring the rows from the backend to the frontend was the bottleneck, then you might be better off getting the list of per information in a cursor and then for each day get the records for that day. I can't imagine this being the case if the only redundant information was the date.