Stephan, Joseph,
> Because d.id was guaranteed to be unique, you might be able to
> count(distinct d.id) and get the result you want. [I think the
> subquery is a nicer way of representing it]
Plus a several SQL implementations don't implement the DISTINCT until
after the COUNT, reuslting in a
> > And postgres tries to be helpful again... :( [I *really* dislike this
> > adding to from list thing] Technically the above should be illegal
> > because no from list contains u or a. Postgres is adding them to the
> > from list for you.
> >
> I get the same result if I do:
> select count(d
On Mon, 19 Mar 2001, Joseph Shraibman wrote:
> I want to select all the entries from d that have at least one
> corresponding entry in u that meets my conditions. The problem is that
> count(*) is returning the number of corresponding entries in u, and I
> want only the number of entries in d.
Stephan Szabo wrote:
>
> On Mon, 19 Mar 2001, Joseph Shraibman wrote:
>
> > I want to select all the entries from d that have at least one
> > corresponding entry in u that meets my conditions. The problem is that
> > count(*) is returning the number of corresponding entries in u, and I
> > wan
Joseph,
SImple as pie (e.g., easy on your 100th one):
> select count(*) from d where status = 2 and d.id = u.dkey and
> u.status =
> 2 and not u.b and u.akey = a.key and a.status = 3;
Count(*) will always count the number of records in the largest table in
your join. If you want the nu
I want to select all the entries from d that have at least one
corresponding entry in u that meets my conditions. The problem is that
count(*) is returning the number of corresponding entries in u, and I
want only the number of entries in d. How do I do this?
create table d(
id