Suppose I have the following tables:
- Customers
- Products
- CustomerProducts
Is there a way to make a choice from the Customers and Products tables where the values are NOT in the map table? Basically, I need an appropriate list of customers and products that they do NOT belong to.
Another twist: I need to connect one client to the product. So, if 5 clients do not have product A, only the first client in the request should have product A. Thus, the results look something like this:
(Assume all customers have their own product B, and more than one customer owns products A, C, and D)
- Customer 1, product A
- Customer 2, product C
- Customer 3, Product D
: UPDATE SQL Sever. :
1, A
UPDATE Customers
SET Customers.UnownedProduct = ProductA
WHERE Customers.CustomerID = Customer1ID
, SQL. , 1 , .
, ! !