You are here: NOW() « PHP SQL « IT news, forums, messages
NOW()

Posted by at on 10/13/06 21:06

Im using postgres 8.1 I'm trying to delete old records in a table by date.


table look like this:

Table "jobhist"
Column | Type | Modifiers
-----------------+-----------------------------+-------------------------------
sched_date | date | not null default
'0000-01-01'
schedlog_file | character varying(16) | not null
start_time | timestamp without time zone |

How do I delete records over a month old from sched_date?

delete from jobhist where start_time < now() - interval '2 month';

I even tried :

delete from jobhist where sched_date < now() - interval '2 month';


Does not work!? What am I doing wrong? This is obviously not getting
the date in the correct format.



when I do now() I get:
now
-------------------------------
2006-10-13 17:02:18.067126-04
(1 row)

select now() - interval '2 month';
?column?
------------------------------
2006-08-13 16:51:09.40038-04
(1 row)

Anyone know what Im doing incorrectly?

thanks!

-Rob

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация