pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Abdul Wahab Dahalan <wahab@mimos.my>
To: pgsql-sql@postgresql.org
Subject: Need Help : Query problem
Date: Wed, 19 Nov 2003 09:26:02 +0800
Message-ID: <3FBAC6AA.80404@mimos.my> (raw)

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.





view thread (2+ messages)  latest in thread

Message-ID: <3FBAC6AA.80404@mimos.my>
Permalink:  ../3FBAC6AA.80404@mimos.my/
Also on:    postgresql.org/message-id/3FBAC6AA.80404@mimos.my

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: wahab@mimos.my
  Subject: Re: Need Help : Query problem
  In-Reply-To: <3FBAC6AA.80404@mimos.my>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox