I have a Character class with a .tags attribute; the .tags attribute is a list of Tag objects. in a many-to-many relationship. I’m trying to write a query that will find all pairs of characters that don’t have the same name that have at least one tag in common; how would I go about doing this?
Share
You go about this as following:
The SQL query (with
WITHclause on SQL Server for the sake of test data) is as below (obviously your table and column names might be different):The complete sample code with the query you need is below: