Subject Re: [firebird-support] need some script help (newbie)
Author Lucas Franzen
Iip Umar Rifai schrieb:
> Hi All,
>
> Could you help me how to get column with contain like an example below using sql
> command;
>
> A.data :
> type name
> A Atype
> B Btype
> C Ctype
> A Atype
> D Dtype
> B BType
> E Etype
>
> B.Result :
> type count
> A 2
> B 2
> C 1
> D 1
> E 1
>
> C.Result :
> count Total
> 2 2
> 1 3


I think the easisest way is to certate a view that represents B and then
do a select group by on the View.

Like:
CREATE VIEW VIEW_COUNT_A ( TYPE, A_COUNT )
AS ( SELECT TYPE, COUNT(*) FROM A GROUP BY TYPE )

and query that view with:

SELECT A_COUNT, COUNT (*) FROM VIEW_COUNT_A
GROUP BY A_COUNT

Luc.