表名是"学生" 列是s_id,tests_date,form和OtherIformation A到I. yaml文件的条件如下:
/*OPT and s.tested_date <= :Date */
/*OPT and s.form in ( :formFilter ) */
/*OPT and s.OtherInformationA in (:otherInformationA) */
/*OPT OR s.OtherInformationB in (:otherInformationB) */
/*OPT OR s.OtherInformationC in (:otherInformationC) */
/*OPT OR s.OtherInformationD in (:otherInformationD) */
/*OPT OR s.OtherInformationE in (:otherInformationE) */
/*OPT OR s.OtherInformationF in (:otherInformationF) */
/*OPT OR s.OtherInformationH in (:otherInformationH) */
/*OPT OR s.OtherInformationG in (:otherInformationG) */
/*OPT OR s.OtherInformationI in (:otherInformationI) */
只有那些传递给yaml的参数才会反映在MySql本机查询中。 EX: 在设置参数Date,form和otherInformation A时,我们将本机sql查询作为
SELECT * FROM Student
WHERE s.tested_date <= :Date
AND s.form in ( :formFilter )
AND s.OtherInformationA in (:otherInformationA);
在上述情况下,我只获得那些设置了otherInformationA的学生 我需要&#39;或&#39; OtherInformations之间的条件,这样我将使用otherInformationA或OtherInformationB或OtherInformationC等获得学生。
以上代码在传递给查询的参数为&#39; date&#39;,&#39; form&#39;和&#39;其他信息B&#39; 在这种情况下,我得到SQL查询
SELECT * FROM Student
WHERE s.tested_date <= :Date
AND s.form in ( :formFilter )
OR s.OtherInformationB in (:otherInformationB)
但我需要本机sql查询:
SELECT * FROM Student
WHERE s.tested_date <= :Date
AND s.form in ( :formFilter )
AND (s.OtherInformationB in (:otherInformationB) Or s.OtherInformationC in (:otherInformationC) or s.OtherInformationD in (:otherInformationD));
我如何申请AND&amp;在yaml文件中使用OR条件?