Re: duplicate dates

From: Christopher Browne <cbbrowne(at)libertyrms(dot)info>
To: Jodi Kanter <jkanter(at)virginia(dot)edu>
Cc: Postgres SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: duplicate dates
Date: 2003-08-01 15:57:44
Message-ID: 60oez9l69z.fsf@dev6.int.libertyrms.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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)

Browse pgsql-sql by date

  From Date Subject
Next Message Jamie Lawrence 2003-08-01 17:02:42 Re: Fwd: Bad Join moment - how is this happening?
Previous Message Jodi Kanter 2003-08-01 15:56:30 duplicate dates