Re: query, display questions

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Michael Hanna <zen(at)hwcn(dot)org>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: query, display questions
Date: 2003-07-03 15:31:12
Message-ID: Pine.LNX.4.33.0307030929420.22131-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Thu, 3 Jul 2003, Michael Hanna wrote:

> I have a table:
>
> michael=# \d healthnotes
> Table "public.healthnotes"
> Column | Type | Modifiers
> --------+--------------------------
> +-------------------------------------------------------------
> posted | timestamp with time zone | not null default
> ('now'::text)::timestamp(6) with time zone
> notes | text |
> Indexes: healthnotes_pkey primary key btree (posted)
>
> 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?
>
> Not sure how to go about this.
>
> Another question: I want to echo in an html page the timestamp and the
> note after it is entered. What php-pgsql commands do this?

I posted some untested code and posted it to phpbuilder to do this. What
I do is just grab the whole data set and use a while loop to go through
each row. I store the first column and then compare it on each iteration,
if it changes then print it out, otherwise print a blank kinda thing

http://www.phpbuilder.com/board/showthread.php?s=&postid=10373627#post10373627

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Bruno Wolff III 2003-07-03 15:36:13 Re: query, display questions
Previous Message Michael Hanna 2003-07-03 15:19:14 query, display questions