2016-11-08 64 views
0

我有查詢中,我使用避免特定列的重複值的分區,但它仍然是給重複的行下面我是提到我的查詢中,我使用的分區我們如何在Oracle查詢使用分區

SELECT iol.M_product_id as faultyProduct , iol.SERIALNO,iol.M_product_id as newproduct, ma.Description, 
        mp.M_Product_category_id ,mi.issotrx, co.C_BPartner_ID, 
       ROW_NUMBER() OVER(PARTITION BY ma.Description ORDER BY iol.M_product_id DESC) rn 
       FROM M_inoutline iol 

       inner join M_inout mi ON (iol.m_inout_id = mi.m_inout_id) 
       inner join C_Order co ON (co.c_order_id = mi.c_order_id) 
       inner Join M_AttributeSetInstance ma ON (ma.m_attributesetinstance_id =iol.m_attributesetinstance_id) 
       inner join M_Product mp ON (mp.m_product_id = iol.m_product_id) 
      where mp.m_product_category_id= 1000447 AND mi.issotrx = 'Y'; 

請幫我

+0

對於那些特殊的列你想避免重複? –

+0

您能否更具體地瞭解您的需求? – FreeMan

回答

0

對於我來說,它看起來你想做的事:

select * from (/*YOUR QUERY*/) where rn = 1;