From imran@sdpi.org Mon Oct 10 10:24:08 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C96B6D98A9 for ; Mon, 10 Oct 2005 07:24:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39940-09 for ; Mon, 10 Oct 2005 10:24:02 +0000 (GMT) Received: from mail.sdpi.org (mail.sdpi.org [210.56.14.210]) by svr1.postgresql.org (Postfix) with ESMTP id 2CACBD97D5 for ; Mon, 10 Oct 2005 07:24:00 -0300 (ADT) Received: from mis ([192.168.1.185]) by mail.sdpi.org (8.12.11/8.12.11) with SMTP id j9AAHe32023239 for ; Mon, 10 Oct 2005 15:17:44 +0500 (PKT) Message-ID: <01c201c5cd84$4a2568f0$b901a8c0@sdp.org> From: "M. Imran" To: Subject: Query Question Date: Mon, 10 Oct 2005 15:20:47 +0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01BF_01C5CDAE.30C66880" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: ClamAV 0.80/1119/Thu Oct 6 23:29:53 2005 clamav-milter version 0.80j on mail.sdpi.org X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.402 required=5 tests=[DNS_FROM_RFC_ABUSE=0.374, HTML_60_70=0.027, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200510/104 X-Sequence-Number: 19176 This is a multi-part message in MIME format. ------=_NextPart_000_01BF_01C5CDAE.30C66880 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear all, I want to select distinct CODE and thier respective sex, sex can be = male/female, can I get my result strictly distinct in code. Currently it = duplicate code value for each male and female. I am using this query=20 select distinct(code), id from table Regards, imran ------=_NextPart_000_01BF_01C5CDAE.30C66880 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear all,
    I want to select=20 distinct CODE and thier respective sex, sex can be=20  male/female, can I get my result strictly distinct in code. = Currently=20 it duplicate code value for each male and female. I am using this = query=20
 
select distinct(code), id =  from=20 table
 
Regards,
imran
------=_NextPart_000_01BF_01C5CDAE.30C66880-- From mike@fuhr.org Mon Oct 10 13:37:37 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CCDCDD93AF for ; Mon, 10 Oct 2005 10:37:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51688-04 for ; Mon, 10 Oct 2005 13:37:30 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 13BDDD8C85 for ; Mon, 10 Oct 2005 10:37:31 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j9ADbULU081945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Oct 2005 07:37:33 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j9ADbUio098415; Mon, 10 Oct 2005 07:37:30 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j9ADbUX4098414; Mon, 10 Oct 2005 07:37:30 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 10 Oct 2005 07:37:30 -0600 From: Michael Fuhr To: "M. Imran" Cc: pgsql-admin@postgresql.org Subject: Re: Query Question Message-ID: <20051010133730.GA98353@winnie.fuhr.org> References: <01c201c5cd84$4a2568f0$b901a8c0@sdp.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01c201c5cd84$4a2568f0$b901a8c0@sdp.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/113 X-Sequence-Number: 19185 On Mon, Oct 10, 2005 at 03:20:47PM +0500, M. Imran wrote: > I want to select distinct CODE and thier respective sex, sex can > be male/female, can I get my result strictly distinct in code. > Currently it duplicate code value for each male and female. I am > using this query > > select distinct(code), id from table It's not clear what you're trying to do. Could you post a sample table and data set (CREATE TABLE and INSERT statements) and an example of the results you'd like to see? BTW, this seems off-topic for pgsql-admin, which is supposed to be for discussions of PostgreSQL administration. A more appropriate list might be pgsql-general, pgsql-novice, or pgsql-sql. -- Michael Fuhr