[DisneyPassID] and [PersonID]
are the same value and will be coming a different table.
[MickeyID],[Comment] and [CafeComment] will be the same for all records.
table1
[MickeyID],[DisneyPassID],[Comment],[CafeComment],[PersonID] )
12 , 1234, 'test', 'sample', 1234)
table2
[goofID],[GoofPassID],[Comment]
23, 2334, 'blue', `enter code here`
21, 2311, 'test',
23, 5432, 'yellow',
23, 1221, 'test',
23, 5533, 'blue',
23, 1223, 'blue',
21, 2334, 'blue',
21, 2311, 'test',
23, 5432, 'yellow',
23, 1221, 'test',
25, 5533, 'blue',
23, 1223, 'yellow',
Query for table2. Basically I'm gathering all GoofPassIDs based on Comment uf they are blue or yellow and goofID 23
SELECT GoofPassID
FROM [Space004].[dbo].[table2]
where
(Comment = 'blue'
or Comment = 'yellow'
)
and goofID = 23
will gives me 2334,5432, 5533..etc..
Desired result would be
table1
[MickeyID],[DisneyPassID],[Comment],[CafeComment],[PersonID] )
12 , 1234, 'test', 'sample', 1234)
12 , 2334, 'test', 'sample', 2334)
12 , 5432, 'test', 'sample', 5432)
Any ideas on how to write this?