pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Hanna <zen@hwcn.org>
To: pgsql-php@postgresql.org
Subject: query, display questions
Date: Thu, 3 Jul 2003 11:19:14 -0400
Message-ID: <B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org> (raw)

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?

Michael




view thread (5+ messages)  latest in thread

Message-ID: <B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org>
Permalink:  ../B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org/
Also on:    postgresql.org/message-id/B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: zen@hwcn.org
  Subject: Re: query, display questions
  In-Reply-To: <B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org>
  References: <B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox