X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9FB34D1CADD for ; Tue, 4 Nov 2003 15:05:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 11502-08 for ; Tue, 4 Nov 2003 11:05:23 -0400 (AST) Received: from unix.mail.Virginia.EDU (unix.mail.Virginia.EDU [128.143.2.28]) by svr1.postgresql.org (Postfix) with ESMTP id C6489D1B4EF for ; Tue, 4 Nov 2003 11:05:09 -0400 (AST) Received: from smtp.mail.Virginia.EDU (smtp.mail.Virginia.EDU [128.143.22.52]) by unix.mail.Virginia.EDU (Postfix) with ESMTP id E9284AADD for ; Tue, 4 Nov 2003 10:04:58 -0500 (EST) Received: from virginia.edu (d-137-133-128.bootp.Virginia.EDU [137.54.133.128]) by smtp.mail.Virginia.EDU (Postfix) with ESMTP id 970472102C for ; Tue, 4 Nov 2003 10:04:58 -0500 (EST) Message-ID: <3FA7C2CE.4000902@virginia.edu> Date: Tue, 04 Nov 2003 10:16:30 -0500 From: Jodi Kanter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres SQL List Subject: query assistance Content-Type: multipart/alternative; boundary="------------040008040309000208080508" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/14 X-Sequence-Number: 15829 This is a multi-part message in MIME format. --------------040008040309000208080508 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Is there a straight forward way to pull out duplicates in a particular field given a value in another field? For example, I have a table that lists users and study names associated with those users. Each user can have one or more study names. My goal is to determine if any of these people have duplicate study names. There are duplicated study names across the system and that is ok. I just want to see if any users have duplicate study names among their studies. My table looks like this: Table "public.study" Column | Type | Modifiers --------------+-----------------------------+------------------------------------------ sty_pk | integer | not null default nextval('pk_seq'::text) study_name | character varying(128) | not null start_date | timestamp without time zone | sty_comments | text | created_by | integer | Indexes: study_pkey primary key btree (sty_pk) I am concerened with study_name. The created_by field tells me who owns it. Thanks Jodi -- /_______________________________ //Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu / / / / / --------------040008040309000208080508 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Is there a straight forward way to pull out duplicates in a particular field given a value in another field?
For example, I have a table that lists users and study names associated with those users. Each user can have one or more study names. My goal is to determine if any of these people have duplicate study names. There are duplicated study names across the system and that is ok. I just want to see if any users have duplicate study names among their studies.
My table looks like this:

                                   Table "public.study"
    Column    |            Type             |                Modifiers                
--------------+-----------------------------+------------------------------------------
 sty_pk       | integer                     | not null default nextval('pk_seq'::text)
 study_name   | character varying(128)      | not null
 start_date   | timestamp without time zone |
 sty_comments | text                        |
 created_by   | integer                     |
Indexes: study_pkey primary key btree (sty_pk)

I am concerened with study_name. The created_by field tells me who owns it.
Thanks
Jodi

--
________________________________

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


 

 

 

--------------040008040309000208080508--