I am trying to insert a non duplicate records into a table but which doing so I am unable to insert it it gives me (0 row(s) affected). And actually the table itself is empty and I am insert new records. To ignore inserting duplicate records I am doing it in the query which I have added below.
Insert Into OrderDetails (CustomerID, CustomerName, OrderID, OrderDate, ProductID, ProductName, Unit, Price)
SELECT c.CustomerID, c.CustomerName, i.OrderID, i.OrderDate, p.ProductID, p.ProductName, p.Unit, p.Price
FROM Customers c
INNER JOIN items i ON c.CustomerID=i.CustomerID
INNER JOIN itemsDetails id ON i.OrderID = id.OrderID
INNER JOIN Products P ON p.ProductID = id.ProductID
Inner Join OrderDetails od ON c.CustomerID = od.CustomerID
where c.CustomerID != od.CustomerID
Am I Inserting correctly?