SQLTeam.com | Weblogs | Forums

Need to subquery both tables. What is the preferred method?

this is the sort of query i want but it's generating too many results. I only wanted to know if this event_name is also in the table but with the other program.
I also need to add a column to indicate that it's in both programs.
select wv1.worker_role, wv1.event_name from event_worker_role_view wv1 where wv1.worker_role in('A29i Licensed')

and wv1.event_name = (select wv2.event_name from event_worker_role_view wv2 where
wv2.worker_role = 'A31 Service')

order by wv1.worker_role, wv1.event_name

the results: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

We could guess what failing means but it would help if you provide us more details on what failing means

I got it working, using in and not = in the subquery.