I have a table with columns: conditional1, conditional2, data. I need to return all the rows where conditional1 = value1 if any of those rows also contains conditional2 = value2. How can I do this?
Edit: There's some confusion about what I'm asking.
If you have columns
`conditional1 | conditional2 | data
A | A | A
A | B | A`
I want to return both rows if conditional1 = A and conditional2 = B
Edit 2: There's still some confusion.
Here is another example:
conditional1 | conditional2 | data
1 | 1 | A
1 | 2 | B
2 | 1 | C
2 | 2 | D
If conditional1 = 1 and conditional2 = 1, it should return
1 | 1 | A
1 | 2 | B
If conditional1 = 2 and conditional2 = 1, it should return
2 | 1 | C
2 | 2 | D
If conditional1 = 2 and conditional2 = 2, it should return
2 | 1 | C
2 | 2 | D
If conditional1 = 2 and conditional2 = 3, it should return no rows.