Subject Re[2]: [firebird-support] need some script help (newbie)
Author Iip Umar Rifai
Hi Lucas,

Thank you very much, I will try your suggestion.

Regards,

-iip-

--------------- Replied message --------------
The Bat! mailer ver 1.53d
----------------------------------------------
Date : Tuesday, March 02, 2004
From : Lucas Franzen <luc@...>
To : firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Subject : [firebird-support] need some script help (newbie)
----------------------------------------------


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.





Yahoo! Groups Links





----------------------------------------------