I am creating a Zend_Db_Select statement for this SQL :
SELECT table1.a AS a
table1.b AS b
COUNT(table2.a) -1 as c
FROM table1
INNER JOIN table2 ON table1.a = table2.a
HAVING c = 1
The select is tested and it worked as expected.
The Zend_Db_Select will be used to paginate the result using
Zend_Paginator_Adapter_DbSelect.
Problem:
When Zend_Paginator_Adapter_DbSelect::count() method is executed, to
determine the total number of rows that the select will return, an error
will be thrown:
[message:protected] => SQLSTATE[42S22]: Column not found: 1054 Unknown
column 'c' in 'having clause'
This is caused by Zend_Db_Select::setRowCount() that creates an special
select based on the select defined in Zend_Paginator_Adapter_DbSelect.
setRowCount() alters the columns that will be used to run the select and
when the fetch is issued the above error will be thrown.
--
View this message in context:
http://www.nabble.com/-Zend_Paginator--Bug-when-using-complex-Zend_Db_Select-tp20561842p20561842.html
Sent from the Zend Framework mailing list archive at Nabble.com.