Need Help : Query problem - Mailing list pgsql-sql

From Abdul Wahab Dahalan
Subject Need Help : Query problem
Date
Msg-id 3FBAC6AA.80404@mimos.my
Whole thread Raw
Responses Re: Need Help : Query problem
List pgsql-sql
Hi Everybody!

If I've a table like belowkk | kj | pngk | vote
----+----+------+------01 | 01 | a    |   1001 | 01 | b    |   1001 | 01 | c    |   1001 | 02 | a    |   1001 | 02 | b
 |   1001 | 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.




pgsql-sql by date:

Previous
From: Yasir Malik
Date:
Subject: Re: Arrays - a good idea?
Next
From: "Merrall, Graeme"
Date:
Subject: Re: SOLVED: Emulating 'connect by prior' using stored proc