DBI question: binding params in HAVING clauses

Jeff Anderson captvanhalen at gmail.com
Thu Jan 26 15:01:12 GMT 2006

On 1/25/06, David Cantrell <david at cantrell.org.uk> wrote:

> > >  And do you have a solution?
> > Use sprintf.
> Use sprintf in what manner?

Like so?

my $sql = sprintf('
     SELECT COUNT(actors.name), countries.name
       FROM actorsXcountries, countries, actors
      WHERE actors.id = actorsXcountries.actorid AND
            countries.id = actorsXcountries.countryid
   GROUP BY countries.name
     HAVING COUNT(actors.name) < %d
   ORDER BY COUNT(actors.name)
', $dbh->quote(3));


More information about the london.pm mailing list