I'm trying to write a complex SQL select statement in Medoo that involves some AND criteria and some OR criteria.
The following is the statement I wrote:
debug()->select("ValuesEvaluationInstrument", "*", ["AND"=> ['secondReviewComplete' => "Yes"], "OR" => $filters]);
This prints the SQL query:
SELECT * FROM "ValuesEvaluationInstrument" WHERE "yearInstrumentPublished" IN ('2019','2018','2017','2016','2015','2014','2013','2012','2011','2010') OR "validated" IN ('Yes') OR "secondReviewComplete" IN ('Yes')
However, it should print:
SELECT * FROM "ValuesEvaluationInstrument" WHERE "yearInstrumentPublished" IN ('2019','2018','2017','2016','2015','2014','2013','2012','2011','2010') OR "validated" IN ('Yes') AND "secondReviewComplete" IN ('Yes')
What I'm trying to achieve is get the "secondReviewComplete" column to be an AND so that all results returned have this column as Yes.
Can someone please help writing this correctly?