How can I convert the following query with db_select
SELECT *
FROM 'my_table'
WHERE
(condition1 < "value1" AND ((conidition2 > "value2") OR (condition3 < "value3")))
OR
(condition4 < "value5" AND ((condition6 < "value6") OR (condition7 < "value7")))
I am trying with
$query = db_select('mytable');
$query->condition(
db_and()->condition("condition1","value1")
->condition(
db_or()->condition("condition2","value2")->condition("condition3","value3")
));
$query->condition(
db_and()->condition("condition4","value4")
->condition(
db_or()->condition("condition5","value5")->condition("condition6","value6")
));
$query_debugg = $query->__toString();
dpm($query_debugg);
issue is with the "AND" in between where is should be "OR", it is expected I know.how can I change it
Output String
SELECT
FROM
{mytable} mytable
WHERE ( (condition1 = :db_condition_placeholder_0) AND( (condition2 = :db_condition_placeholder_1) OR (condition3 = :db_condition_placeholder_2) ))AND( (condition4 = :db_condition_placeholder_3) AND( (condition5 = :db_condition_placeholder_4) OR (condition6 = :db_condition_placeholder_5) ))
db-or
as a tag so you definitely know where to start, just edit the question with details of that code, and the errors you get, and I'm sure you'll get a good answer