Thread: Need clarification

Need clarification

From
palanivel.kumaran@scandent.com
Date:



how can retrieve rows where the datedifference is more than 30...
assume there exists a field named 'datacreated' which is of type 'date'. I
need to compare it with the current date and need to extract the matched
rows....

thanks in advance.

Palanivel

Important Email Information :- The  information  in  this  email is
confidential and may  be  legally  privileged. It  is  intended  solely for
the addressee. Access to  this email  by anyone  else  is  unauthorized.  If
you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. If you are not the intended addressee please contact
the sender and dispose of this e-mail immediately.



Re: Need clarification

From
Achilleus Mantzios
Date:
O palanivel.kumaran@scandent.com έγραψε στις May 23, 2005 :

> 
> 
> 
> 
> how can retrieve rows where the datedifference is more than 30...

more than 30 in what units?
years,days,milliseconds??

> assume there exists a field named 'datacreated' which is of type 'date'. I
> need to compare it with the current date and need to extract the matched
> rows....
> 

select * from footable where datacreated = now()::date;

> thanks in advance.
> 
> Palanivel
> 
> Important Email Information :- The  information  in  this  email is
> confidential and may  be  legally  privileged. It  is  intended  solely for
> the addressee. Access to  this email  by anyone  else  is  unauthorized.  If
> you are not the intended recipient, any disclosure, copying, distribution or
> any action taken or omitted to be taken in reliance on it, is prohibited
> and may be unlawful. If you are not the intended addressee please contact
> the sender and dispose of this e-mail immediately.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
> 

-- 
-Achilleus



Re: Need clarification

From
KÖPFERL Robert
Date:
Your're looking for the interval data type.

timestamp - timestamp 
or date - date   can be compared with interval
CURRENT_TIMESTAMP - '4d'::interval => today - 4 days

|-----Original Message-----
|From: palanivel.kumaran@scandent.com
|[mailto:palanivel.kumaran@scandent.com]
|Sent: Montag, 23. Mai 2005 11:52
|To: pgsql-sql@postgresql.org
|Subject: [SQL] Need clarification
|
|
|
|
|
|
|how can retrieve rows where the datedifference is more than 30...
|assume there exists a field named 'datacreated' which is of 
|type 'date'. I
|need to compare it with the current date and need to extract 
|the matched
|rows....
|
|thanks in advance.
|
|Palanivel
|
|Important Email Information :- The  information  in  this  email is
|confidential and may  be  legally  privileged. It  is  
|intended  solely for
|the addressee. Access to  this email  by anyone  else  is  
|unauthorized.  If
|you are not the intended recipient, any disclosure, copying, 
|distribution or
|any action taken or omitted to be taken in reliance on it, is 
|prohibited
|and may be unlawful. If you are not the intended addressee 
|please contact
|the sender and dispose of this e-mail immediately.
|
|
|---------------------------(end of 
|broadcast)---------------------------
|TIP 3: if posting/reading through Usenet, please send an appropriate
|      subscribe-nomail command to majordomo@postgresql.org so that your
|      message can get through to the mailing list cleanly
|


Re: Need clarification

From
palanivel.kumaran@scandent.com
Date:



Sorry, I didn't get ur point...please, tell me exact query to extract the
rows from a table A which contains a date field named DTE  whose difference
is 30 days as compared to the current date...


Thanks & Regards
Palanivel P.K


                                                                                           KÖPFERL Robert
                                      <robert.koepferl@so        To:       "'palanivel.kumaran@scandent.com'"
         norys.at>                   <palanivel.kumaran@scandent.com>, pgsql-sql@postgresql.org
Sentby:                   cc:                                        pgsql-sql-owner@pos        Subject:  Re: [SQL]
Needclarification                     tgresql.org

      05/23/2005 04:34 PM
                                                                           




Your're looking for the interval data type.

timestamp - timestamp
or date - date   can be compared with interval
CURRENT_TIMESTAMP - '4d'::interval => today - 4 days

|-----Original Message-----
|From: palanivel.kumaran@scandent.com
|[mailto:palanivel.kumaran@scandent.com]
|Sent: Montag, 23. Mai 2005 11:52
|To: pgsql-sql@postgresql.org
|Subject: [SQL] Need clarification
|
|
|
|
|
|
|how can retrieve rows where the datedifference is more than 30...
|assume there exists a field named 'datacreated' which is of
|type 'date'. I
|need to compare it with the current date and need to extract
|the matched
|rows....
|
|thanks in advance.
|
|Palanivel
|
|Important Email Information :- The  information  in  this  email is
|confidential and may  be  legally  privileged. It  is
|intended  solely for
|the addressee. Access to  this email  by anyone  else  is
|unauthorized.  If
|you are not the intended recipient, any disclosure, copying,
|distribution or
|any action taken or omitted to be taken in reliance on it, is
|prohibited
|and may be unlawful. If you are not the intended addressee
|please contact
|the sender and dispose of this e-mail immediately.
|
|
|---------------------------(end of
|broadcast)---------------------------
|TIP 3: if posting/reading through Usenet, please send an appropriate
|      subscribe-nomail command to majordomo@postgresql.org so that your
|      message can get through to the mailing list cleanly
|

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate     subscribe-nomail command to
majordomo@postgresql.orgso that your     message can get through to the mailing list cleanly 



Important Email Information :- The  information  in  this  email is
confidential and may  be  legally  privileged. It  is  intended  solely for
the addressee. Access to  this email  by anyone  else  is  unauthorized.  If
you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. If you are not the intended addressee please contact
the sender and dispose of this e-mail immediately.



Re: [despammed] Re: Need clarification

From
Andreas Kretschmer
Date:
am  23.05.2005, um 16:31:55 +0530 mailte palanivel.kumaran@scandent.com folgendes:
> 
> 
> 
> 
> Sorry, I didn't get ur point...please, tell me exact query to extract the
> rows from a table A which contains a date field named DTE  whose difference
> is 30 days as compared to the current date...


test=# create table datediff (start date);
CREATE TABLE
test=# insert into datediff values ('1966/08/30');
INSERT 153382679 1
test=# insert into datediff values ('2005/05/23');
INSERT 153382680 1
test=# select * from datediff ;  start
------------1966-08-302005-05-23
(2 Zeilen)

test=# select * from datediff where CURRENT_DATE - start > 10;  start
------------1966-08-30
(1 Zeile)

test=# select * from datediff where CURRENT_DATE - start < 10;  start
------------2005-05-23
(1 Zeile)



Btw.: please no TOFU, read http://en.wikipedia.org/wiki/TOFU


Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net===    Schollglas Unternehmensgruppe    ===