I have a form that is giving me information like INPUT1, INPUT2. I need to select from COL1 and COL2 开发者_开发知识库where COL1 = INPUT1, COL2 = INPUT2
or the other way around, COL1 = INPUT2, COL2 = INPUT1.
SELECT * FROM table WHERE
(COL1 = INPUT1 AND COL2 = INPUT2)
OR (COL1 = INPUT2 AND COL2 = INPUT1);
SELECT * FROM table WHERE ( COL1=INPUT1 AND COL2=INPUT2 ) OR ( COL1=INPUT2 AND COL2=INPUT1 )
select * from table_name where ( COL1=INPUT1 AND COL2=INPUT2 ) OR ( COL1=INPUT2 AND COL2=INPUT1 ) ;
精彩评论