X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id ED341B4276B for ; Mon, 7 Jul 2003 09:19:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 85228-06 for ; Mon, 7 Jul 2003 06:19:15 -0300 (ADT) Received: from www.epecon.de (www.epecon.de [194.174.52.125]) by svr1.postgresql.org (Postfix) with ESMTP id 28E7BB42167 for ; Mon, 7 Jul 2003 06:19:15 -0300 (ADT) From: "listrec" To: "Shahbuddin Md Isa" , Subject: Re: Merge Record in Database(SQL Statement) Date: Mon, 7 Jul 2003 11:19:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-reply-to: <200307070123.h671Nh119524@mail.umm.com.my> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/57 X-Sequence-Number: 14171 Not quite sure what the question is.... Assuming, you would like to normalize the data, I suggest to create 4 tables: create table gpa (id integer primary key,gpa varchar(32) not null unique); create table major (id integer primary key,major varchar(32) not null unique); create table birthplace (id integer primary key,birthplace varchar(32) not null unique); create table xxx ( id integer primary key, attributename varchar(64) not null, -- this might be unique too id_major integer references major(id), id_birthplace integer references birthplace(id), id_gpa integer references gpa(id) ); insert into gpa (id,gpa) values (1,'excellent'); insert into major (id,major) values (1,'science'); insert into birthplace (id,birthplace) 1,'India'); insert into xxx (id,attributename,id_major,id_birthplace,id_gpa) values (1,'Record 1',1,1,1); insert into xxx (id,attributename,id_major,id_birthplace,id_gpa) values (1,'Record 2',1,1,1); Now selecting the records would be something like: select x.attributename,m.major,b.birthplace,g.gpa from attributename a,major m,birthplace b,gpa g where x.id_major=m.id and x.id_birthplace=b.id and x.id_gpa=g.id Hope that helps.... Detlef -----Ursprüngliche Nachricht----- Von: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]Im Auftrag von Shahbuddin Md Isa Gesendet: Montag, 7. Juli 2003 03:24 An: pgsql-sql@postgresql.org Betreff: [SQL] Merge Record in Database(SQL Statement) Hai.. How to merge record in database(sql statement) if record same attribute, examples:- Attribute Major Birth_Place GPA Record 1 science India excellent Record 2 science India excellent Please help me.. ____________________________________________________________ Powered by Fastmail from http://www.i-fastmail.com ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html