This isn't as simple as the title. (What is an appropriate title?) I think the easiest way to describe my issue is with an example.
My goal is a list of what color balloon’s each child is missing.
Let’s assume table 1 contains the following data in 2 columns:
Child BalloonColor
- Sally Yellow
- Sally White
- Sally Blue
- Bob Red
- Bob Green
- Bob White
This is table 2, also 2 columns.
ColorCode Color
- Y Yellow
- W White
- R Red
- B Blue
- G Green
- P Pink
I need a write a result set that states what color balloon each child needs to have all colors.
- Sally, R, Red
- Sally, G, Green
- Sally, P, Pink
- Bob, Y, Yellow
- Bob, B, Blue
- Bob, P, Pink
My example is small, but assume I have a 1000 children in my table 1 and 75 colors in table 2. How can I check each child, one at a time, is my ultimate question? A Not in
query will only yield "P, Pink", but you can see I need it at the child level, not table level.
I'm not a developer, but can write good SQL statements.
MS SQL Server 2008 R2.
Thanks in advance, Mike.