Subject | Re: Invalid Query or Bug ? |
---|---|
Author | alex_vnru |
Post date | 2002-02-18T10:46:22Z |
--- In ib-support@y..., hans@h... wrote:
Select X.A, Count(*)
From X,Y
Where Y.B=X.A
Group By X.A
and output like
A count
1 13
2 6
....
If you want 0 counts too, use left join.
Best regards, Alexander V.Nevsky
> what I really wanted wasHans, don't you really want
>
> SELECT DISTINCT A,
> (SELECT COUNT(*) FROM TABLE Y WHERE Y.B = X.A)
> FROM TABLE X
Select X.A, Count(*)
From X,Y
Where Y.B=X.A
Group By X.A
and output like
A count
1 13
2 6
....
If you want 0 counts too, use left join.
Best regards, Alexander V.Nevsky