[![enter image description here](https://i.stack.imgur.com/SdIKk.png)](https://i.stack.imgur.com/SdIKk.png)

I need to retrieve distinct AHQ-WS1 value FROM STYPE column where SCODE is having both 9531 AND 9569.

Basically common STYPE value of two different SCODE values but also being distinct.

Is it possible with only query or need java code seperately?