我处于一种情况,我必须动态创建一个查询来缩小我的搜索结果。我需要根据用户从主题/标准复选框中的选择动态地在查询中添加“AND”条件。
SELECT First_Name, Last_Name, City, Subject_1, Subject_2, Subject_3, Standard_From, Standard_To FROM TutorProfile WHERE City = 'Mumbai' AND (Subject_1 = 'Maths' OR Subject_2 = 'Maths' OR Subject_3 = 'Maths') AND (Subject_1 = 'Physics' OR Subject_2 = 'Physics' OR Subject_3 = 'Physics') .. AND (Standar_From = 'Class XII') ..