I have the below test table with the following rows in the table.
table: test_set(id (pk), pid int, fc int, fl int)
pid fc fl
1 7 30
1 8 31
1 9 35
2 7 39
2 8 40
Now if I run
SELECT pid FROM test_set WHERE fl=30 OR fl=35 GROUP BY pid;
#Result :
pid
---
1
As expected but if I want to run
SELECT pid FROM test_set WHERE fl=30 AND fl=35 GROUP BY pid;
#Result :
result set (0) # Nothing matched!
This is too as expected but I want to go beyond expectation here. My logic here is that fl=30 and fl=35 both have pid=1 in common i.e. when they are intersected they yeilds pid=1
So to be specific I need the result of multiple values of fl column that have one or more pid in common.
I have already read this this and commented there too.
See Question&Answers more detail:os