troubleshooting Question

Filtering T-SQL statement based on 2 combined values in a SUB-QUERY

Avatar of Harreni
HarreniFlag for Saudi Arabia asked on
Microsoft SQL ServerSQL
4 Comments1 Solution47 ViewsLast Modified:
Hi Experts,

I want to filter my query below based on 2 combined values from a sub-query which is (ConsumerID nvarcha(255) PK &  DatasetID int) using Exists OR IN Operators. So, how to do that?

SELECT 
 C.ConsumerID 
, C.ConsumerName
, S.ServiceArabicName
, DSI.ServiceID
, DSI.DatasetID
, DSI.DatasetActivatedToUsedByService 
,DS.DatasetName
, DS.DatasetAvaiableOnGSB
FROM   Datasets_Services_Intersection DSI INNER JOIN
             Datasets DS ON DSI.DatasetID = DS.DatasetID INNER JOIN
             Services S ON DSI.ServiceID = S.ServiceID INNER JOIN
             Consumers C ON S.ConsumerID = C.ConsumerID

	  WHERE C.ConsumerID & DatasetID in
			 (
			 SELECT DSNA.ConsumerID,DSI.DatasetID  
			 FROM DatasetsNEEDSACTIVATION DSNA
			 )


Thanks a lot in advance,
Harreni
ASKER CERTIFIED SOLUTION
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros