Re: [SQL] Order by birthdate

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: Tim J Trowbridge <trowbrid(at)writeme(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Order by birthdate
Date: 1998-06-11 10:52:59
Message-ID: Pine.LNX.3.96.980611104627.2637C-100000@proxy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

> I'm trying to generate a birthday list ordered by month, then by day.
> This is what I thought would work...
>
> SELECT name,birthdate FROM table WHERE birthdate is not null ORDER BY
> date_part('month',birthdate)

I don't understand why you need specify month to sort tuples, you may order
it by birthday, but if you want it anyway try this:

SELECT name, EXTRACT(month FROM birthdate) AS mese
FROM table WHERE birthdate is not null
ORDER BY mese
>
> but psql returns:
>
> ERROR: parser: parse error at or near "("
>
> What's the problem?
Seems that order by doesn't supports a function as parameter.
Jose'

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jose' Soares Da Silva 1998-06-11 11:41:24 Re: [INTERFACES] Re: M$-Access'97 and TIMESTAMPs
Previous Message Jose' Soares Da Silva 1998-06-11 09:44:20 Re: [SQL] Re: [INTERFACES] Re: M$-Access'97 and TIMESTAMPs