peppiv has asked for the wisdom of the Perl Monks concerning the following question:
Jan Feb Mar New York 115 0 0 Florida 34 0 0 Georgia 28 0 0
my $sth = $dbh->prepare("SELECT DISTINCT state, COUNT(*) FROM con +tacts WHERE state != '' AND identifier BETWEEN '2003-01-01' AND '2003 +-02-01' GROUP BY state ORDER BY 2 DESC"); $sth->execute() or die $sth->errstr; my $rows = 0; while (my @result = $sth->fetchrow_array()) { last if $rows++ >= 10; print qq(<tr><td><p style="margin-left: 10"><font size="2" face=" +Arial">$result[0]</font></td><td><div align="right"><font size="2" fa +ce="Arial"> </font></div></td><td><font size="2" face="Arial"><d +iv align="right">$result[1]</div></font></td><td><div align="right">< +font size="2" face="Arial">0</font></div></td><tr>\n); } $sth->finish();
Jan Feb Mar New York 115 100 0 Georgia 28 45 0 Florida 34 10 0
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Selecting and ordering data over multiple date ranges
by gmax (Abbot) on Feb 07, 2003 at 16:55 UTC | |
by peppiv (Curate) on Feb 07, 2003 at 18:55 UTC | |
Re: Selecting and ordering data over multiple date ranges
by dws (Chancellor) on Feb 07, 2003 at 19:29 UTC | |
Re: Selecting and ordering data over multiple date ranges
by steves (Curate) on Feb 07, 2003 at 15:52 UTC | |
by CountZero (Bishop) on Feb 07, 2003 at 16:43 UTC | |
Re: Selecting and ordering data over multiple date ranges
by steves (Curate) on Feb 07, 2003 at 16:25 UTC | |
by peppiv (Curate) on Feb 07, 2003 at 16:45 UTC |