Re: deleting records is failing

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "Tim Vadnais" <tvadnais(at)earthlink(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: deleting records is failing
Date: 2005-12-08 03:21:23
Message-ID: B71E2642-8BCE-4FED-8F70-AD498E8EFEBA@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Dec 8, 2005, at 12:13 , Tim Vadnais wrote:

> I have a set of records spanning several dates, and I want to
> delete some
> records within a specific date range. For example, I have a record
> for each
> day from Sept 1 through Nov 1, and I want to delete the records for
> Sept 21
> through 10/20 and leave all the rest.
>
> Here is my query that's deleting all the records for the episode
> DELETE FROM tracker WHERE tracker.episode_id = 238 AND
> ( rug_tracker.date_of_service < '09/12/2005'
> OR rug_tracker.date_of_service > '10/20/2005' );

DELETE FROM tracker
WHERE episode_id = 238
AND date_of_service BETWEEN '2005-09-21'::date and '2005-10-20'::date;

Note that between is inclusive, so if you don't want Sept 21 (or is
it Sept 12? you've used one in your explanation and another in your
SQL) and Oct 20, you can use BETWEEN '2005-09-22' AND '2005-10-19'
instead.

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Rylander 2005-12-08 03:46:02 Re: Memory Leakage Problem
Previous Message Tim Vadnais 2005-12-08 03:13:18 deleting records is failing