Simsons
Simsons

Reputation: 12745

How to get the Selected rows based on Multiple Column Values

Name           Value

Base            0  
Type            0  
Serialized      1  
C4              0  
c5              0

I am getting the Above values by having following query.

Select T2.Name,Convert(Bit,T2.Value) from  [Table1] T1
join [Table2] T2 with(nolock) on T1.Id = T2. Id
where T1.SID= 'DDXRS' 

But I need the rows whose Name is either Base,Type or Seralized? I tried creating temp Table but could not get to the result.

Upvotes: 0

Views: 25

Answers (1)

bakersman
bakersman

Reputation: 68

You just need to include your desired results in the filter:

Select T2.Name,Convert(Bit,T2.Value) from  [Table1] T1
join [Table2] T2 with(nolock) on T1.Id = T2. Id
where T1.SID= 'DDXRS' AND T2.Name IN ('Base', 'Type', 'Serialized')

Upvotes: 1

Related Questions