Name Value
Base 0
Type 0
Serialized 1
C4 0
c5 0
我通过以下查询得到以上值。
Select T2.Name,Convert(Bit,T2.Value) from [Table1] T1
join [Table2] T2 with(nolock) on T1.Id = T2. Id
where T1.SID= 'DDXRS'
但我需要名称为Base,Type或Seralized的行?我尝试创建临时表但无法得到结果。
答案 0 :(得分:1)
您只需要在过滤器中包含所需的结果:
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')