select PEGGED_SO_ID,PEGGED_SO_LINE_ID ,ITEM_ID ,QUANTITY ,LOCATION ,SITEID from IN_SEMI_ONHAND_LOCKED
where item_id in ('000000101011003137','000000102011000038') ;
SELECT DISTINCT PEGGED_SO_ID,PEGGED_SO_LINE_ID ,ITEM_ID ,QUANTITY ,LOCATION ,SITEID ,ROW_NUMBER() OVER(PARTITION BY ITEM_ID,LOCATION ORDER BY NULL)RN FROM IN_SEMI_ONHAND_LOCKED where item_id in ('000000101011003137','000000102011000038') ;
SELECT * FROM (SELECT DISTINCT PEGGED_SO_ID,PEGGED_SO_LINE_ID ,ITEM_ID ,QUANTITY ,LOCATION ,SITEID ,ROW_NUMBER() OVER(PARTITION BY ITEM_ID,LOCATION ORDER BY NULL)RN FROM IN_SEMI_ONHAND_LOCKED) where rn=1 and item_id in ('000000101011003137','000000102011000038')