Re: exists

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: exists
Date: 2001-08-21 05:40:54
Message-ID: Pine.BSF.4.21.0108202239210.3144-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Mon, 20 Aug 2001, Joseph Shraibman wrote:

> I want to select a boolean if there exists a row in another table that matches this one.
> So I did select ..., (select count(*) from table2 where ...) > 0 ...
> but that count(*) was taking forever. I know there is a better way to do it, but whenever
> I try to use EXISTS I get a syntax error. What is the proper way?

Hmm, on current sources I can do:
select ..., exists (select * from table2 where ...) from table1;

I don't know if that's new though...

In response to

  • exists at 2001-08-21 02:05:40 from Joseph Shraibman

Responses

  • Re: exists at 2001-08-21 15:24:32 from Joseph Shraibman

Browse pgsql-sql by date

  From Date Subject
Next Message Bhuvan A 2001-08-21 05:54:08 is it possible to use arrays in plpgsql function??
Previous Message Carolyn Lu Wong 2001-08-21 05:19:39 database location question