Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 737151337B4E for ; Tue, 12 Oct 2010 19:30:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 14813-05 for ; Tue, 12 Oct 2010 22:30:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id C1B291335B36 for ; Tue, 12 Oct 2010 19:30:29 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Tue, 12 Oct 2010 17:30:29 -0500 Message-Id: <4CB49B3402000025000368C0@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Tue, 12 Oct 2010 17:30:28 -0500 From: "Kevin Grittner" To: "Richard Broersma" , "Ben Kim" Cc: Subject: Re: compare two rows References: <4CB479DB02000025000368A9@gw.wicourts.gov> <20101012201747.GA720@tamu.edu> <20101012221055.GC985@tamu.edu> In-Reply-To: <20101012221055.GC985@tamu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/104 X-Sequence-Number: 35845 Ben Kim wrote: > create table test_dup (id serial primary key, val text); > How can I check whether the two rows are the same or different? Well, with a primary key in there, they had *better* be different. It would seem you want to see if some *subset* of the columns in two rows match? All columns except those in the primary key? The next question is whether you want to just compare two specific rows or list all duplicates. -Kevin