最好在程序中动态组成SQL 语句:
select * from In_Item_Pro_Dtl
where PropertyID ='001' and val > 0.0010 --这儿的条件应由程序组合
and PropertyID ='002' and val > 0.0010
and PropertyID ='004' and val > 0.0020
select * from In_Item_Pro_Dtl
where PropertyID ='001' and val > 0.0010 --这儿的条件应由程序组合
and PropertyID ='002' and val > 0.0010
and PropertyID ='004' and val > 0.0020
PropertyID ='001' and val > 0.0010 and PropertyID ='002' and val > 0.0010
and PropertyID ='004' and val > 0.0020上面条件是不行.
where BatchNO in(select BatchNO from In_Item_Pro_Dtl where PropertyID ='001' and val > 0.0010 )
and BatchNO in(select BatchNO from In_Item_Pro_Dtl where PropertyID ='002' and val > 0.0010 )
and BatchNO in(select BatchNO from In_Item_Pro_Dtl where PropertyID ='004' and val > 0.0020 )
where m.BatchNo in (Select BatchNo=cast
when (((d.PropertyID='001') or (d.PropertyID='002'))
and (d.Val>0.0010)) then d.BatchNo
when ((d.PropertyID='004') and (d.Val>0.0020)) then d.BatchNo
Else NULL end from In_Item_Pro_Dtl as d )
还有其他不同的吗?