Customer|Product_Code|List_Price|Unit_Price|Unit_Unit_Price|Unit_List_Price|
--------+------------+----------+----------+---------------+---------------+
3BEACHES|CA050608 |9.46 |9.46 |EACH |EACH
3BEACHES|CA050608 |9.46 |9.46 |INNER |EACH
3BEACHES|CA050608 |9.46 |9.46 |SHIPPER |EACH
In my select statement I am joining 4 Views - Customer,Product,Price Book and List Price View and I want only 1 row for a combination of Customer and Product_Code, I am getting 3 rows as attached above because there are different values in Unit_Unit_Price field for some Products, it can be any one of "EACH" or "INNER" or "SHIPPER" but just 1.
I can't put a Where clause on any 1 Value(Each,Inner or Shipper) because for some Customer-Product_Code line it's just showing 1 row(Shipper or Each or Inner), so if I am using where clause on any 1 value of Unit_Unit_Price field then it's deducting the records which is not correct.
What I want: there are no repeating rows for Customer-Product_Code combination, I just need unique rows.
Code I am using:
SELECT TOP (100) PERCENT skh.ARCUS.IDCUST,
skh.ICITEM.ITEMNO AS product_code,
skh.ICITEM.CNTLACCT,
skh.v_list_price_each.price AS list_price,
skh.v_price_book.price,
skh.v_list_price_each.unit AS Expr2,
skh.v_price_book.price_unit
FROM skh.ARCUS
INNER JOIN skh.v_price_book ON skh.ARCUS.PRICLIST = skh.v_price_book.price_list
INNER JOIN skh.ICITEM ON skh.v_price_book.item_short = skh.ICITEM.ITEMNO
AND skh.v_price_book.company = skh.ICITEM.AUDTORG
INNER JOIN skh.v_list_price_each ON skh.v_price_book.item_short = skh.v_list_price_each.item_short
WHERE (skh.ICITEM.INACTIVE = 0)
AND (skh.ARCUS.SWACTV = 1)
ORDER BY skh.ARCUS.IDCUST