DBI question: binding params in HAVING clauses
david at cantrell.org.uk
Wed Jan 25 16:35:43 GMT 2006
Using SQLite, if I execute this, with the value in the HAVING clause
just there in plain text, it works:
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) < 3
ORDER BY COUNT(actors.name)
but if instead I replace the 3 with a placeholder, and supply it like
$sth = $dbh->prepare('...');
then the HAVING clause seems to be ignored, and I later get too many
Has anyone come across this before? And do you have a solution?
FWIW, I'm using perl 5.8.4, DBD::Sqlite 1.5, and 1.42.
David Cantrell | London Perl Mongers Deputy Chief Heretic
If you have received this email in error, please add some nutmeg
and egg whites, whisk, and place in a warm oven for 40 minutes.
More information about the london.pm