--- lib/A3C/View.pm 2008/04/11 23:23:42 79 +++ lib/A3C/View.pm 2008/04/12 10:29:30 83 @@ -25,7 +25,7 @@ dt { _('Number of persons in system') } dd { $people->count } - my $sql = A3C::SQL->new({ query => qq{ + my $by_towns = A3C::SQL->new({ query => qq{ select count(uid),l from organizations inner join towns on towns.name = l @@ -34,15 +34,41 @@ limit 25 }}); - dt { _('Top %1 towns by schools', $sql->count) } + dt { _('Top %1 towns by schools', $by_towns->count) } dd { ul { - while ( my $row = $sql->next ) { + while ( my $row = $by_towns->next ) { li { outs_raw( $row->count, ' ', $row->l ) } } } } + my $by_county = A3C::SQL->new({ query => qq{ + select + count(uid) as schools, + county, + count(distinct municipality) as municipalities + from organizations + inner join towns on towns.name = l + group by county + order by schools desc + }}); + + dt { _('Schools by counties') } + dd { + table { + th { _('Schools') } + th { _('County') } + th { _('Municipalities') }; + while ( my $row = $by_county->next ) { + row { + cell { $row->schools } + cell { $row->county } + cell { $row->municipalities } + } + } + } + } };