Inclusions & exclusions

How can I do Inclusion & exclusion in my query?

  • For example, in the below relationship how can I exclude B?
A<-->B<-->C