Re: comparring dates between perl and postgres

From: Sai Hertz And Control Systems <sank89(at)sancharnet(dot)in>
To: hodges(at)xprt(dot)net
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: comparring dates between perl and postgres
Date: 2003-12-03 23:24:27
Message-ID: 3FCE70AB.7070209@sancharnet.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have never used extract. This generates a syntax error when I added

>and select extract( DOY FROM date)
>
> $sth = $dbh->prepare("SELECT date,address,time,host,direction,description,
> cal,reminder from firesides and select extract( DOY FROM date)
> where date > '$dstr1' and date <= '$dstr2'");
> if ($sth->execute)
> {
># assign each query record to an array
> $numrow = 0;
> while
> (($date,$address,$time,$host,$directions,$description,$cal,$reminder,
>$db_doy) = $sth->fetc\
>hrow)
>
>
>
As per me the error is quite evident because it must be some thing
like this

select extract(DOY FROM date'COLUMN_FIELD')

CREATE TABLE test_date (
"id" BIGSERIAL,
"exp_date" DATE,
"comp_int" int,
PRIMARY KEY("id")
)

add some data
and do as

prompt=# select comp_int as Compared_Integer , extract( DOY from
exp_date) as Compared_Date from test_date where id = 1 ;
compared_integer | compared_date
------------------+---------------
1 | 335
(1 row)

this may gve you results .

Regards,
V kashyap

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Wolfgang Rohdewald 2003-12-04 00:06:27 Re: multiline PL/Python function fails in *.sql
Previous Message hodges 2003-12-03 22:24:38 Re: comparring dates between perl and postgres