Issue Type: Bug Created: 2010-12-21T04:11:49.000+0000 Last Updated: 2012-11-20T21:37:56.000+0000 Status: Open Fix version(s): Reporter: Phellipe Kelbert (pkelbert) Assignee: None Tags: - Zend_Db
Related issues: Attachments:
i guess it's a very specific need of mine. for avoiding data overload at some point i query only for records' ids sorted by other descriptive field. all that in a pagination context. the code can be summarized as follows:
$table = new My_Table(); $select = $table->select(false); $select->from($table, 'id_field'); $select->order('description_field'); $select->limit(20, 10); $statement = $select->query(); # crashes here
as i'm using pdo_mssql adapter and it has a workaround for the limit() method, the generated query is this:
SELECT * FROM ( __SELECT TOP 20 * FROM ( ____SELECT TOP 30 "my_table"."id_field" FROM "my_table" ORDER BY "description_fied" ASC __) AS inner_tbl __ORDER BY "my_table" DESC ) AS outer_tbl ORDER BY "description_field" ASC
the inner_tbl has only "id_field" and the outermost select tries to order by "description_field".
the simplest workaround is to select both id and description fields but it would be great to see this bug fixed in the framework.
thanks in advance.
No comments to display
Have you found an issue?
See the Overview section for more details.