[eluser]german.zvonchuk[/eluser]
The query itself is not complicated, I just wanted to write it using the Active records, without passing SQL code.
Using the array below, I need to make Active Records query, which will produce SQL code shown below.
Example array:
Code:
Array
(
[id_item_type] => Array
(
[0] => 1
[1] => 2
)
[id_street] => Array
(
[0] => 158
[1] => 209
)
[id_item_target] => Array
(
[0] => 1
[1] => 2
)
)
Code:
SELECT COUNT(*) AS `numrows`
FROM (`item`)
WHERE
(`id_item_type` = '1'
OR `id_item_type` = '2')
AND
(`id_street` = '158'
OR `id_street` = '209')
AND
(`id_item_target` = '1'
OR `id_item_target` = '2')