Sql database question need to pull data from both tables that doesn't exist in the other
Posted on 2007-08-07
The result I am looking for is to select Distinct product_no from two Price_Lists. This is only producing product_no from one price_list. Can you help?
SELECT DISTINCT Accessories.Product_no AS [Part Number], Accessories.Product_desc_txt AS [Accessory Description], PRICE_PROD.UOM_CD AS UOM, PRICE_PROD.PRODUCT_PRC AS Price, Accessories.Oracle_Product_no, Accessories.Main_txt, Accessories.Sub_txt, Accessories.Third_txt, PRICE_PROD.Price_List_No FROM Accessories INNER JOIN PRICE_PROD ON Accessories.Product_no = PRICE_PROD.PRODUCT_NO WHERE ((PRICE_PROD.Price_List_No = 300) AND Not Exists(SELECT Accessories.Product_no From Accessories INNER JOIN PRICE_PROD ON Accessories.Product_no = PRICE_PROD.PRODUCT_NO Where PRICE_PROD.Price_List_No = 234)) OR PRICE_PROD.Price_List_No =234 ORDER BY Accessories.Product_no