I wants to do something like this,
SELECT * FROM product p
JOIN product_version pv ON p.id = pv.product_id
where (p.code, pv.product_version) in (("FF6",1), ("FF12", 1));
But this is giving error at in clause.
Can someone provide the correct syntax.
3
Answers
You probably can’t go with
IN
, depending on your goal you need to do something like:or, if the logic above was not what you meant, maybe:
or
This code should work for you
You are not providing any information about the actual error neither about column types.
But, by the way, it really looks like that those double quotes are wrong because in Postgres strings are quoted using simple quotes (
'
), not double ("
).Try:
Despite that, your query looks syntactically "correct" unless some kind of type mismatching we cannot foresee without more information.