Sample Header Ad - 728x90

Selecting values that are not associated with one side of a many to many relationship

2 votes
1 answer
653 views
I have a junction table between categories and values that indicate which categories are associated with which each value. I would like to find the values that are not associated with each category. Category: ID CategoryName -- ------------ 1 category1 2 category2 3 category3 CategoryValue: CategoryID ValueID ---------- ------- 1 1 1 2 2 1 3 2 Value: ID ValueName -- --------- 1 value1 2 value2 3 value3 The output I would like for the query is the following: CategoryID ValueID ValueName ---------- ------- --------- 1 3 value3 2 2 value2 2 3 value3 3 1 value1 3 3 value3 I'm pretty stuck on how to approach this as a query. The "junction" table seems to prevent the usual LEFT JOIN WHERE null approach. So any advice would be much appreciated.
Asked by andyb (227 rep)
Nov 16, 2012, 10:43 AM
Last activity: Dec 3, 2018, 06:20 PM