Re: SELECT Query - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: SELECT Query
Date
Msg-id 20021101121455.GD26650@svana.org
Whole thread Raw
In response to SELECT Query  (Scott Taylor <scott.taylor@4i-dotcom.com>)
List pgsql-general
On Fri, Nov 01, 2002 at 11:58:23AM +0000, Scott Taylor wrote:
> Below is the result of a query on my table. I want to only return those
> transactions that have a chart_id=10074, and if trans_id 10088 is one of
> those, I want to return all 3 rows with that trans_id.

Hmm...

select * from acc_trans where trans_id in
    (select trans_id from acc_trans where chart_id = 10074);

You can rewrite that as an EXISTS query, but it should work fine.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Attachment

pgsql-general by date:

Previous
From: Scott Taylor
Date:
Subject: SELECT Query
Next
From: Richard Huxton
Date:
Subject: Re: SELECT Query