From: | Michael Fork <mfork(at)toledolink(dot)com> |
---|---|
To: | Lotus118 <lotus118(at)excite(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: distinct date problem |
Date: | 2001-02-26 15:05:22 |
Message-ID: | Pine.BSI.4.21.0102261003570.11377-100000@glass.toledolink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
This should work:
SELECT distinct(date_part('year', <date field>)) FROM <<date table>>;
Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio
On Sun, 25 Feb 2001, Lotus118 wrote:
> Hi,
> I'm having difficulty figuring this one out:
> I have a table with record entries which all have a date attribute, looking
> something like '2000-11-11'. What I want from my data base is a list of
> all the years that are present in this attribute in the relation. So for
> example, if I had a couple of records like:
> 2000-11-05
> 1988-02-09
> 1999-10-06
> 2001-08-08
> 1999-09-27
> 2001-04-04
> I would want the query to return:
> 2000-11-05
> 1988-02-09
> 1999-10-06
> 2001-08-08
> So that I get only the distict years.
> How does one go about this?
> Thanks,
> Lotus
>
From | Date | Subject | |
---|---|---|---|
Next Message | Qiqi Dong | 2001-02-26 15:19:01 | Function to return recordset |
Previous Message | Oliver Elphick | 2001-02-26 15:01:23 | Re: sum(bool)? |