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 3C380D1D5A2 for ; Wed, 19 Nov 2003 01:26:40 +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 52726-10 for ; Tue, 18 Nov 2003 21:26:12 -0400 (AST) Received: from filter.mimos.my (filter.mimos.my [192.228.137.70]) by svr1.postgresql.org (Postfix) with ESMTP id 762B8D1D614 for ; Tue, 18 Nov 2003 21:26:07 -0400 (AST) Received: from ew.mimos.my (localhost.localdomain [127.0.0.1]) by filter.mimos.my (8.11.6/8.11.6) with ESMTP id hAJ1Q9E12244 for ; Wed, 19 Nov 2003 09:26:09 +0800 Received: (from root@localhost) by ew.mimos.my (8.12.8p2/8.12.3) id hAJ1Q8pt090489 for pgsql-sql@postgresql.org; Wed, 19 Nov 2003 09:26:08 +0800 (MYT) (envelope-from wahab@mimos.my) Received: from mimos.my (sol-wel197.nat.mimos.my [10.1.23.197]) by ew.mimos.my (8.12.8p2/8.11.6) with ESMTP id hAJ1Q65f090207 for ; Wed, 19 Nov 2003 09:26:08 +0800 (MYT) (envelope-from wahab@mimos.my) Message-ID: <3FBAC6AA.80404@mimos.my> Date: Wed, 19 Nov 2003 09:26:02 +0800 From: Abdul Wahab Dahalan User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Need Help : Query problem X-scanner: scanned by Inflex 1.0.10 - (http://pldaniels.com/inflex/) Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/230 X-Sequence-Number: 16045 Hi Everybody! If I've a table like below kk | kj | pngk | vote ----+----+------+------ 01 | 01 | a | 10 01 | 01 | b | 10 01 | 01 | c | 10 01 | 02 | a | 10 01 | 02 | b | 10 01 | 03 | a | 10 How do I write a query so that I can get a result as below [ select only a record/s with same kk and kj but different pngk. For example here I've 3 records with same kk=01,kj=01 but diff pngk=a,b,c and 2 records with same kk=01,kj=02 but diff pngk=a,b] > kk | kj | pngk | vote > ----+----+------+------ > 01 | 01 | a | 10 > 01 | 01 | b | 10 > 01 | 01 | c | 10 > 01 | 02 | a | 10 > 01 | 02 | b | 10 Thanks.