A
A
Alexander Gontarev2014-08-17 12:46:17
Zend Framework
Alexander Gontarev, 2014-08-17 12:46:17

How in ZF2 how to use LIMIT after a combined UNION query?

Let's consider everything in order:
There are two queries of the type

$select1; //Zend\Db\Sql\Select
$select2; //Zend\Db\Sql\Select
Using query aggregation, $select->combine($select2);we get the following query: Next, if we use the limit method, we get the following query: Here is the question. How to make the output get a request: The solution I found:
(SELECT ...) UNION (SELECT ...) $select->limit(69)
(SELECT ... LIMIT 0,69) UNION (SELECT ...)

(SELECT ...) UNION (SELECT ...) LIMIT 0,69
$adapter->query($sql->getSqlStringForSqlObject($select) . ' LIMIT 0,69');
is not true, because you need to use a paginator that will substitute limit itself .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Damir Makhmutov, 2014-08-19
@igontarev

But this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question