From: Christopher Browne <cbbrowne@libertyrms.info>
To: Jodi Kanter <jkanter@virginia.edu>
Cc: Postgres SQL List <pgsql-sql@postgresql.org>
Subject: Re: duplicate dates
Date: Fri, 01 Aug 2003 11:57:44 -0400
Message-ID: <60oez9l69z.fsf@dev6.int.libertyrms.info> (raw)
Jodi Kanter wrote:
> I have one table that has a date/time field in it. I'd like to identify
> the records in the database where the date/time fields are the same. How
> can I do this? Do I need to create a view or temp table? Is there a way
> to run through one table multiple times.
If you plan to review the data multiple times, and the table is rather
large, then it probably makes sense to make a temp table.
select a.* into temp table my_dupes from
dated_table a, dated_table b
where a.event_on = b.event_on
-- Assuming that the primary key is on (field1, field2, field3)
and a.key_field1 <> b.key_field1
and a.key_field2 <> b.key_field2
and a.key_field3 <> b.key_field3;
You could then rummage through my_dupes as needed. Note that if there
are more than 2 simultaneous records, it will list all of them
multiple times :-(.
You may also want to be more precise about what you mean by 'date/time
fields are the same'. They go down to fractions of a second, so you
shouldn't have a huge number of collisions.
--
output = ("cbbrowne" "@" "libertyrms.info")
<http://dev6.int.libertyrms.com/;
Christopher Browne
(416) 646 3304 x124 (land)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: cbbrowne@libertyrms.info, jkanter@virginia.edu
Subject: Re: duplicate dates
In-Reply-To: <60oez9l69z.fsf@dev6.int.libertyrms.info>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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