pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marin D <marin@cybernet.bg>
To: Tim J Trowbridge <trowbrid@writeme.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Order by birthdate
Date: Thu, 11 Jun 1998 10:49:35 +0300 (EET DST)
Message-ID: <Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com> (raw)
In-Reply-To: <357F4370.5BB8@writeme.com>



On Wed, 10 Jun 1998, Tim J Trowbridge wrote:

> 
> SELECT name,birthdate FROM table WHERE birthdate is not null ORDER BY
> date_part('month',birthdate)
> 
> but psql returns:
> 
> ERROR:  parser: parse error at or near "("
> 
> What's the problem?
> 

Two problems here:

1. The date_part() which u use in the order by clause is not in the target
list

2. Even if it was it wouldn't work as AFAIK functions are not allowed in
the order by clause

Try this:

 SELECT name,birthdate, date_part('month',birthdate) as birth_month
 FROM table 
 WHERE birthdate is not null 
 ORDER BY birth_month;


Any better idea???

	Marin


	
          -= Why do we need gates in a world without fences? =-





view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com>
Permalink:  ../Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com/
Also on:    postgresql.org/message-id/Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com

 · 

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: marin@cybernet.bg, trowbrid@writeme.com
  Subject: Re: [SQL] Order by birthdate
  In-Reply-To: <Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com>
  References: <357F4370.5BB8@writeme.com> <Pine.LNX.3.96.980611103741.7530B-100000@server.iclub.techno-link.com>

* 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