Subject: | count syntax |
Date: | Wed, 11 Jan 2017 15:40:24 +0000 |
To: | "bug-SQL-Abstract-More [...] rt.cpan.org" <bug-SQL-Abstract-More [...] rt.cpan.org> |
From: | RAPPAZ Francois <francois.rappaz [...] unifr.ch> |
Hi there
I use SQL ::Abstract ::More version 1.28
I call select with the following parameters
'-from' => [
'-join',
'jrnabt',
'noabt=noabt',
'abo'
],
'-having' => {
'-count' => {
'jrnabt.noabt' => {
'>' => 1
}
},
'abo.noabt' => '919'
},
'-columns' => [
'abo.noabt'
],
'-group_by' => 'abo.noabt'
};
The generated sql (with the value added) is
SELECT abo.noabt FROM jrnabt INNER JOIN abo ON ( jrnabt.noabt = abo.noabt ) GROUP BY abo.noabt HAVING ( ( (COUNT jrnabt.noabt > '1') AND abo.noabt = '919') )
This fails (r You have an error in your SQL syntax; check the manual ... )
The correct sql should be
SELECT abo.noabt FROM jrnabt INNER JOIN abo ON ( jrnabt.noabt = abo.noabt ) GROUP BY abo.noabt HAVING ( ( COUNT(jrnabt.noabt > '1') AND abo.noabt = '919' ) )
Note that there must be no space after count.
Am I missing something in the way I call select or is it a bug ?
Thanks
François