开发者

Selecting a row where, 1=a, 2=b OR 1=b, 2=a

开发者 https://www.devze.com 2023-02-08 00:01 出处:网络
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 = I

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 ) ;

0

精彩评论

暂无评论...
验证码 换一张
取 消