I have a table with data like below,
keyId att_id att_value
1 1 4
1 2 5
2 1 4
I have my input to a procedure as a json {"1":"4","2":"5"}
.
My procedure should return me the keyId which has both (att_id = 1 and att_value = 4) and (att_id=2 and att_value=5). So the output of this json input should be only 1 and not 2 as the second key value pair in json is not satisfied. Is there any way to dynamically append the and conditions inside a stored procedure in postgresql.