query question - Mailing list pgsql-novice

From Michael Hanna
Subject query question
Date
Msg-id B80E6DB4-AD6B-11D7-80D3-00039308EB2C@hwcn.org
Whole thread Raw
Responses Re: query question  (Manuel Sugawara <masm@fciencias.unam.mx>)
Re: query question  (Josh Berkus <josh@agliodbs.com>)
List pgsql-novice
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.


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Noobie: Problems with a query
Next
From: Manuel Sugawara
Date:
Subject: Re: query question