Hello,

I will admit I have not done as much homework as perhaps I should.
(using mysql 3.21.33b and perl5.004_04 built for i386-bsdos)

I have a voting script. Each time someone votes I insert values for 
the following:

refer  remote_addr cookie day  time ad

where 'ad' is what they voted for.

And then I show the current results of the voting.  This is where I 
think I am using an inefficient solution.

my $sql = "SELECT ad from superbowl";
my($all,$rows) = $db->read("$dbase","$table","$sql");

foreach  my $line (@$all) {
        my($ad) = @$line;
        $count{$ad}++;
}

and then I iterate:

foreach my $name (sort {$count{$b} <=> $count{$a}} keys %count) {


I think I can bypass the need for the hash and then sorting on the 
hash if I use the proper sql statement.

Am I correct? Would a better sql statement avoid the hash stuff?  
What book would anyone recommend to beef up my comprehension of sql?

Thanks,

Peter







-----------------------------------------------------------
Send a mail to [EMAIL PROTECTED] with
unsubscribe mysql [EMAIL PROTECTED]
in the body of the message to unsubscribe from this list.

Reply via email to