pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sandis <sandisj@parks.lv>
To: pgsql-sql@postgresql.org
Subject: date comparision
Date: Fri, 7 Jul 2000 21:07:41 +0300
Message-ID: <005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv> (raw)

Is anyone out here can give some advice?

i have a table with a timestamp field.
i should know if there is records for the particular year and month
so i need a query like (in MySQL it was very simple, but i should move to
postgres!):

SELECT something FROM mytable WHERE MONTH('timestamp_field')=07
               AND YEAR('timestamp_field')=2000 LIMIT 1;

So, i am looking for date/time functions:

SELECT * FROM table WHERE date_part('year',timestamp 'timestamp_field') =
2000;

but it doesn't work...(ERROR:  Bad abstime external representation
'timestamp_field')
may be i need subselect or abstime(timestamp) function??

I suppose it's a lame q, but i cannot solve it today...
Thanks!





view thread (3+ messages)  latest in thread

Message-ID: <005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv>
Permalink:  ../005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv/
Also on:    postgresql.org/message-id/005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv

 · 

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: sandisj@parks.lv
  Subject: Re: date comparision
  In-Reply-To: <005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv>
  References: <005a01bfe83e$4fc52600$d17b02c3@mediaparks.lv>

* 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