Heidegger has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Monks, I want to run a COUNT query on mySQL and can't make it work. I'm using DBIx::Recordset interface and I couldn't find an example. If it's not possible to do that with DBIx::Recordset, how they do that with DBI?

Replies are listed 'Best First'.
Re: DBIx::Recordset or DBI COUNT sql
by iguanodon (Priest) on Jan 24, 2003 at 15:54 UTC
    I'm not familiar with DBIx::Recordset but can't you just do
    my $sth = $dbh->prepare('select count(*) from table_name'); $sth->execute; my ($count) = $sth->fetchrow; $sth->finish; print "count: $count\n";