Re: comparring dates between perl and postgres - Mailing list pgsql-novice

From Sai Hertz And Control Systems
Subject Re: comparring dates between perl and postgres
Date
Msg-id 3FCE70AB.7070209@sancharnet.in
Whole thread Raw
In response to Re: comparring dates between perl and postgres  (hodges@xprt.net)
List 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





pgsql-novice by date:

Previous
From: hodges@xprt.net
Date:
Subject: Re: comparring dates between perl and postgres
Next
From: Wolfgang Rohdewald
Date:
Subject: Re: multiline PL/Python function fails in *.sql