Is it possible to add condition within the in clause of postgresql
for example
select ... where (t1.subject,t2.weight) in ((1,2),(2,3))
I want to check whether subject is 1 but weight can be >= 2 not just 2 and so on. So that condition would logically look somewhat like
select ... where (t1.subject,t2.weight) in ((1,>2),(2,>3))
2
Answers
You can select value of object using subquery. Simple just select query subject which are having weight greater than >=2.
select … where (t1.subject,t2.weight) in (select subject FROM … where weight >=2 ,select subject FROM … where weight >=3 );
No, this is not possible. You need to write