zendframework/zf2 — pull request #5854 by ojhaujjwal (2014-02-21 07:05:23+00:00)
Title: Multiple identifiers in `In`

I have an SQL query like this:

`
SELECT * FROM data da
INNER JOIN device_configuration d ON d.id = da.device_id
WHERE (da.device_id, da.recorded_time) IN
(
SELECT device_id, MAX(recorded_time) FROM data group BY device_id
)
AND d.parent_id IS NULL;`

Yes, you are right, it is not supported directly by Zend Framework 2.

With this PR, you can do something like:
```php
$select->where->in(array('column1', 'column2'), $anotherSelect);
````

So, the above query can be written in Zend Framework 2 as:

```php
$maxSelect->columns(array('device_id', new SqlExpression('MAX(recorded_time)')));
$maxSelect->group('device_id');
$select->where->in(array('device_id', 'recorded_time'), $maxSelect);
$select->join(
'device_configuration',
'device_configuration.id = data.device_id'
);
$select->where->isNull('parent_id');
$resultSet = $this->select($select);
```