我的表单提供了INPUT1, INPUT2. I need to select from COL1 and COL2 where COL1 = INPUT1, COL2 = INPUT2
或其他相关信息,COL1 = INPUT2, COL2 = INPUT1.
答案 0 :(得分:7)
SELECT * FROM table WHERE
(COL1 = INPUT1 AND COL2 = INPUT2)
OR (COL1 = INPUT2 AND COL2 = INPUT1);
答案 1 :(得分:3)
SELECT * FROM table WHERE ( COL1=INPUT1 AND COL2=INPUT2 ) OR ( COL1=INPUT2 AND COL2=INPUT1 )
答案 2 :(得分:0)
从table_name中选择* 其中(COL1 = INPUT1和COL2 = INPUT2)或(COL1 = INPUT2和COL2 = INPUT1);