Skip site navigation (1) Skip section navigation (2)

query, display questions

From: Michael Hanna <zen(at)hwcn(dot)org>
To: pgsql-php(at)postgresql(dot)org
Subject: query, display questions
Date: 2003-07-03 15:19:14
Message-ID: B46415C5-AD69-11D7-80D3-00039308EB2C@hwcn.org (view raw or flat)
Thread:
Lists: pgsql-php
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


Responses

pgsql-php by date

Next:From: scott.marloweDate: 2003-07-03 15:31:12
Subject: Re: query, display questions
Previous:From: Bruno Wolff IIIDate: 2003-07-03 11:22:52
Subject: Re: help

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group