pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Mark Volpe <volpe.mark@epamail.epa.gov>
Cc: The Hermit Hacker <scrappy@hub.org>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Ordering a date_part() query ...
Date: Tue, 18 Jan 2000 13:28:40 -0500 (EST)
Message-ID: <200001181828.NAA05364@candle.pha.pa.us> (raw)
In-Reply-To: <3884A6BE.41B2C9CB@epamail.epa.gov>

> The Hermit Hacker wrote:
> > 
> > I have a query that looks like:
> > 
> > SELECT ( date_part('month', stat_period) || '/' ||
> >          date_part('day', stat_period)   || '/' ||
> >          date_part('year', stat_period)  || ' ' ||
> >          date_part('hour', stat_period)  || ':00:00' ) as "Summary - by
> > Day/Hour",
> >        sum(impressions) as impressions, sum(click_thru) as click_thru
> >   FROM banner_count
> > GROUP BY "Summary - by Day/Hour";
> > 
> 
> Try appending ORDER BY "Summary - by Day/Hour"::date
> to your query.

Oh, much better than my CASE idea.  I thought he was sorting date/time
strings, not datetime values.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (13+ messages)  latest in thread

Message-ID: <200001181828.NAA05364@candle.pha.pa.us>
Permalink:  ../200001181828.NAA05364@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200001181828.NAA05364@candle.pha.pa.us

 · 

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-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, volpe.mark@epamail.epa.gov, scrappy@hub.org
  Subject: Re: [SQL] Ordering a date_part() query ...
  In-Reply-To: <200001181828.NAA05364@candle.pha.pa.us>
  References: <3884A6BE.41B2C9CB@epamail.epa.gov> <200001181828.NAA05364@candle.pha.pa.us>

* 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