Re: SELECT Query

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Scott Taylor <scott(dot)taylor(at)4i-dotcom(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT Query
Date: 2002-11-01 12:14:55
Message-ID: 20021101121455.GD26650@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2002-11-01 12:37:42 Re: SELECT Query
Previous Message Scott Taylor 2002-11-01 11:58:23 SELECT Query