Re: duplicate dates - Mailing list pgsql-sql

From Christopher Browne
Subject Re: duplicate dates
Date
Msg-id 60oez9l69z.fsf@dev6.int.libertyrms.info
Whole thread Raw
In response to duplicate dates  (Jodi Kanter <jkanter@virginia.edu>)
List 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    --
Assumingthat 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)


pgsql-sql by date:

Previous
From: Jodi Kanter
Date:
Subject: duplicate dates
Next
From: Jamie Lawrence
Date:
Subject: Re: Fwd: Bad Join moment - how is this happening?