pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Need clarification
5+ messages / 4 participants
[nested] [flat]

* Need clarification
@ 2005-05-23 09:52 palanivel.kumaran@scandent.com
  2005-05-23 10:17 ` Re: Need clarification Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 1 reply; 5+ messages in thread

From: palanivel.kumaran@scandent.com @ 2005-05-23 09:52 UTC (permalink / raw)
  To: pgsql-sql





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.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Need clarification
  2005-05-23 09:52 Need clarification palanivel.kumaran@scandent.com
@ 2005-05-23 10:17 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Achilleus Mantzios @ 2005-05-23 10:17 UTC (permalink / raw)
  To: palanivel.kumaran@scandent.com; +Cc: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Need clarification
@ 2005-05-23 11:01 palanivel.kumaran@scandent.com
  2005-05-23 11:41 ` Re: [despammed] Re: Need clarification Andreas Kretschmer <akretschmer@despammed.com>
  0 siblings, 1 reply; 5+ messages in thread

From: palanivel.kumaran@scandent.com @ 2005-05-23 11:01 UTC (permalink / raw)
  To: KÖPFERL Robert <robert.koepferl@sonorys.at>; +Cc: pgsql-sql; pgsql-sql-owner@postgresql.org





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 
                      Sent by:                   cc:                                                         
                      pgsql-sql-owner@pos        Subject:  Re: [SQL] Need clarification                      
                      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.org so 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.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [despammed] Re: Need clarification
  2005-05-23 11:01 Re: Need clarification palanivel.kumaran@scandent.com
@ 2005-05-23 11:41 ` Andreas Kretschmer <akretschmer@despammed.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Andreas Kretschmer @ 2005-05-23 11:41 UTC (permalink / raw)
  To: pgsql-sql

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-30
 2005-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    === 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Need clarification
@ 2005-05-23 11:04 KÖPFERL Robert <robert.koepferl@sonorys.at>
  0 siblings, 0 replies; 5+ messages in thread

From: KÖPFERL Robert @ 2005-05-23 11:04 UTC (permalink / raw)
  To: 'palanivel.kumaran@scandent.com' <palanivel.kumaran@scandent.com>; pgsql-sql

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
|



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-05-23 11:41 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 09:52 Need clarification palanivel.kumaran@scandent.com
2005-05-23 10:17 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2005-05-23 11:01 Re: Need clarification palanivel.kumaran@scandent.com
2005-05-23 11:41 ` Andreas Kretschmer <akretschmer@despammed.com>
2005-05-23 11:04 Re: Need clarification KÖPFERL Robert <robert.koepferl@sonorys.at>

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