help w/ query

From: "G(dot)L(dot) Grobe" <gary(at)grobe(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: help w/ query
Date: 2001-10-20 00:32:53
Message-ID: 001601c158fe$c261eea0$0200a8c0@trinity
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Anyone help w/ the following sql query ... Here's my tables ...

table A
id name
-----|-------
1000 AA
1001 AB
1002 AC
1003 AD

table B
id pid
-----|-------
1000 1000
1001 1000
1002 1000
1003 1001
1004 1001

Here's my query, (note that 'AA' is all the info I provide,
cause that's the ) ...

SELECT B.id FROM B, A WHERE B.pid = A.id AND A.name = 'AA';

Returns the following resultset ...

id (note, this is from B, but all have pid's of 1000)
------
1000
1001
1002

When what I really want returned is the 1000 from B's table
and only that record ...

id (note, this is what I want from B)
------
1000

Any idea how to grab this?

TIA

Responses

Browse pgsql-general by date

  From Date Subject
Next Message speedboy 2001-10-20 01:18:35 Re: phpPgAdmin 2.3 build broken?
Previous Message Steve 2001-10-19 23:02:11 Inseting multiple rows at onece.