I have the following table in PostgreSQL:
id fid val
--------------------------
200 995 XXLL
200 996 XXLL
201 995 OOOP
201 996 OOOS
202 995 OKIL
202 996 OKIL
203 995 LLLL
203 996 CCCC
What I am trying to do is to get all of the id
s where the value of 995 and 996 are the same.
So in the above example, I would like the output of the SQL query to be just 200, 202, because 201 and 203’s 995 and 996 values are different.
I hope the above makes sense, and any help is much appreciated
2
Answers
Something like this:
Based on your sample data