Subject Re: Invalid Query or Bug ?
Author alex_vnru
--- In ib-support@y..., hans@h... wrote:
> what I really wanted was
>
> SELECT DISTINCT A,
> (SELECT COUNT(*) FROM TABLE Y WHERE Y.B = X.A)
> FROM TABLE X

Hans, don't you really want

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