From jkanter@virginia.edu Fri Aug 1 15:47:17 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C25BFD1C918 for ; Fri, 1 Aug 2003 15:47:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49584-09 for ; Fri, 1 Aug 2003 12:46:09 -0300 (ADT) Received: from mailhub.mail.Virginia.EDU (mail.Virginia.EDU [128.143.2.9]) by svr1.postgresql.org (Postfix) with ESMTP id 7857CD1C911 for ; Fri, 1 Aug 2003 12:47:16 -0300 (ADT) Received: from smtp.mail.Virginia.EDU (smtp.mail.Virginia.EDU [128.143.22.52]) by mailhub.mail.Virginia.EDU (Postfix) with ESMTP id 234AE3251A for ; Fri, 1 Aug 2003 11:47:16 -0400 (EDT) Received: from virginia.edu (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.11.7/8.11.6) with ESMTP id h71FlFl25480 for ; Fri, 1 Aug 2003 11:47:15 -0400 Message-ID: <3F2A8DAE.4060003@virginia.edu> Date: Fri, 01 Aug 2003 11:56:30 -0400 From: Jodi Kanter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 To: Postgres SQL List Subject: duplicate dates Content-Type: multipart/alternative; boundary="------------090601000802000206020004" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/4 X-Sequence-Number: 14620 --------------090601000802000206020004 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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. Thanks. Jodi -- _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu --------------090601000802000206020004 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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.
Thanks.
Jodi
--
________________________________

_______________________________
Jodi L Kanter
BioInformatics Database Administrator
University of Virginia
(434) 924-2846
jkanter@virginia.edu


 

 

 

--------------090601000802000206020004-- From cbbrowne@libertyrms.info Fri Aug 1 15:57:46 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AE62ED1C9CF for ; Fri, 1 Aug 2003 15:57:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 51804-10 for ; Fri, 1 Aug 2003 12:56:38 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id B160BD1C9C9 for ; Fri, 1 Aug 2003 12:57:44 -0300 (ADT) Received: from dev6.int.libertyrms.com ([10.1.2.212] helo=libertyrms.info) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19icHo-0007kE-00; Fri, 01 Aug 2003 11:57:44 -0400 Received: by libertyrms.info (Postfix, from userid 1079) id 5EC42BBAD8; Fri, 1 Aug 2003 11:57:44 -0400 (EDT) To: Jodi Kanter Cc: Postgres SQL List Subject: Re: duplicate dates From: Christopher Browne Date: Fri, 01 Aug 2003 11:57:44 -0400 Message-ID: <60oez9l69z.fsf@dev6.int.libertyrms.info> User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/5 X-Sequence-Number: 14621 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") Christopher Browne (416) 646 3304 x124 (land) From jgardner@jonathangardner.net Fri Aug 8 15:29:50 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3EA29D1C983 for ; Fri, 8 Aug 2003 15:29:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 43541-03 for ; Fri, 8 Aug 2003 12:28:21 -0300 (ADT) Received: from irko.smoothcorp.com (unknown [208.49.241.41]) by svr1.postgresql.org (Postfix) with ESMTP id 5C990D1C4E1 for ; Fri, 8 Aug 2003 12:29:39 -0300 (ADT) Received: from [10.0.1.63] (helo=jgardner.smoothcorp.com) by irko.smoothcorp.com with esmtp (Exim 4.12) id 19l9BR-0004sW-00; Fri, 08 Aug 2003 08:29:37 -0700 Received: from jgardner.smoothcorp.com (localhost.localdomain [127.0.0.1]) by jgardner.smoothcorp.com (8.12.8/8.12.8) with ESMTP id h78FTcsN026107; Fri, 8 Aug 2003 08:29:38 -0700 Received: from localhost (localhost [[UNIX: localhost]]) by jgardner.smoothcorp.com (8.12.8/8.12.8/Submit) id h78FTc5A026105; Fri, 8 Aug 2003 08:29:38 -0700 From: Jonathan Gardner To: Jodi Kanter , Postgres SQL List Subject: Re: duplicate dates Date: Fri, 8 Aug 2003 08:29:36 -0700 User-Agent: KMail/1.5 References: <3F2A8DAE.4060003@virginia.edu> In-Reply-To: <3F2A8DAE.4060003@virginia.edu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200308080829.37711.jgardner@jonathangardner.net> X-SA-Exim-Rcpt-To: jkanter@virginia.edu, pgsql-sql@postgresql.org X-SA-Exim-Scanned: No; SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/70 X-Sequence-Number: 14686 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 01 August 2003 08:56, 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. SELECT date_trunc('month', date_column), ... GROUP BY date_trunc('month', date_column) HAVING count(primary_key) > 1; Replace date_trunc('month', date_column) with whatever you want to group it= =20 by. Note that date_part can give you interesting groupings (all the=20 Decembers, all the 1st of the months, all the Fridays, etc...) If you want to run through it several times, you can have a sub-select in t= he=20 from clause. You could also save the results in a temp table. - --=20 Jonathan Gardner Live Free, Use Linux! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/M8HgWgwF3QvpWNwRAsUNAKCLnB6vajJ8fuS7IRgp0pYxp6YaxgCg2qbk juL5a4tM1la0zmP81PdxS/c=3D =3DN8Q/ -----END PGP SIGNATURE-----