We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2016-03-18
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?

, C.ConsumerName
, S.ServiceArabicName
, DSI.ServiceID
, DSI.DatasetID
, DSI.DatasetActivatedToUsedByService 
, 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  

Open in new window

Thanks a lot in advance,
Watch Question
Senior .Net Consultant
Top Expert 2016
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE