Need Help : Query problem

From: Abdul Wahab Dahalan <wahab(at)mimos(dot)my>
To: pgsql-sql(at)postgresql(dot)org
Subject: Need Help : Query problem
Date: 2003-11-19 01:26:02
Message-ID: 3FBAC6AA.80404@mimos.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Merrall, Graeme 2003-11-19 04:24:25 Re: SOLVED: Emulating 'connect by prior' using stored proc
Previous Message Yasir Malik 2003-11-18 23:51:51 Re: Arrays - a good idea?