Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Kevin Way
* Tom Lane <[EMAIL PROTECTED]> [02-10-01 18:02]: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > I think you could use EXISTS for that, > > select EXISTS (); should give a true/false on whether the > > query returned any rows. I'm not sure if it stops after one row > > or not, but if it doesn't

Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > I think you could use EXISTS for that, > select EXISTS (); should give a true/false on whether the > query returned any rows. I'm not sure if it stops after one row > or not, but if it doesn't you can add a limit 1 to the query. Yes it does stop after

Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Stephan Szabo
On Tue, 2 Oct 2001, Kevin Way wrote: > I'm currently using a SELECT count(*) when all I really want to know is > if 1 or more records exist. Is there a standard way to just find out if > a record exists? If not, is there a way to avoid iterating over all the > records by writing an aggregate fu

[SQL] aggregate functions, COUNT

2001-10-02 Thread Kevin Way
I'm currently using a SELECT count(*) when all I really want to know is if 1 or more records exist. Is there a standard way to just find out if a record exists? If not, is there a way to avoid iterating over all the records by writing an aggregate function? Given what I've read of how they work