解决方案 »

  1.   

    select pro_id
    from 属性和产品对应表 a
    where SX_ID=1 and VALUE= X 
    and exists (select 1 from 属性和产品对应表 where pro_id=a.pro_id and SX_ID=2 and VALUE= Y )
    如果仅是两个属性则可以用下面的简化方法。
    select pro_id
    from 属性和产品对应表 a,属性和产品对应表 b 
    where a.pro_id=b.pro_id
    and a.SX_ID=1 and a.VALUE= X 
    and b.SX_ID=2 and b.VALUE= Y 
      

  2.   

    select 
        pro.pro_name 
    from 
        pro
    where 
        pro_id in 
        (
            select pro_id from pro&sx where (sx_id=1 and value='X') or (sx_id=2 and value='Y')  
        );