我需要一种方法来制作一个 IN 运算符,为每个参数进行不同类型的比较,这样:
SELECT *
FROM Table
WHERE (par1, par2, par3) IN ((par1answer1, par2answer1, par3min1, par3max1),
(par1answer2, par2answer2, par3min2, par3max2),
...,
(par1answern, par2answern, par3minn, par3maxn)
)
解释:
- par1 需要等于 par1answer1 或 par1answer2
- par2 需要等于 par2answer1 或 par2answer2
- par3 需要介于 par3min1 和 par3max1 之间,或 par3min2、par3max2
@EDIT
很抱歉不清楚,我不太擅长解释,但我正在努力!
示例集:
par1 par2 par3
2 5 10
3 6 20
4 7 30
5 8 60
SELECT *
FROM Table
WHERE (par1, par2, par3) IN ((2,5,9,11),
(3,6,11,19),
(5,7,9,100),
(5,8,10,80),
(2,8,0,200))
Result:
par1 par2 par3
2 5 10 //matches first tuple
5 8 60 //matches fourth tuple