peppiv has asked for the wisdom of the Perl Monks concerning the following question:
my $sth = $dbh->prepare('SELECT DISTINCT surveys, COUNT(*) FRO +M neverland GROUP BY surveys ORDER BY surveys DESC'); $sth->execute() or die $sth->errstr; while (my @result = $sth->fetchrow_array()) { my $percent = (@result[1] / $nothernumber)*100; printf qq(<tr><td><font size="2" face="Arial">@result[0]</font +></td><td><font size="2" face="Arial">@result[1]</font></td><td align +="right"><font face="arial" size="2">%.1f%%</td></tr>\n),$percent; }
monkeys gorillas bats | 8 9 2 | 17% 25% 5% |
gorillas monkeys bats | 9 8 2 | 17% 25% 5% |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ORDER BY COUNT(*)?
by Matts (Deacon) on Mar 20, 2002 at 15:36 UTC | |
by Caillte (Friar) on Mar 20, 2002 at 15:48 UTC | |
by aersoy (Scribe) on Mar 20, 2002 at 18:40 UTC | |
by dmmiller2k (Chaplain) on Mar 21, 2002 at 04:28 UTC | |
Re: ORDER BY COUNT(*)?
by rdfield (Priest) on Mar 20, 2002 at 15:37 UTC | |
Re: ORDER BY COUNT(*)?
by strat (Canon) on Mar 20, 2002 at 15:37 UTC | |
Re: ORDER BY COUNT(*)?
by redsquirrel (Hermit) on Mar 20, 2002 at 16:46 UTC | |
by peppiv (Curate) on Mar 20, 2002 at 17:04 UTC | |
by redsquirrel (Hermit) on Mar 20, 2002 at 18:13 UTC | |
by 2mths (Beadle) on Mar 21, 2002 at 11:03 UTC | |
by peppiv (Curate) on Mar 20, 2002 at 19:52 UTC | |
Re: ORDER BY COUNT(*)?
by peppiv (Curate) on Mar 20, 2002 at 15:35 UTC | |
Re: ORDER BY COUNT(*)?
by peppiv (Curate) on Mar 20, 2002 at 15:59 UTC |