Expert Software Company : News

miercuri, 26 mai 2010

Cum sa gasesc facturile neachitate in MySQL?

Table A has a list of all of my products and TABLE has a list of the products that each customer has purchased.

Table A
Product ID | Product Name

Table B
Cust_ID | Product_ID

SELECT a.ProductID, a.ProductName
FROM TableA AS a
LEFT JOIN TableB AS b ON a.ProductID = b.ProductID
AND b.CustID = $custid
WHERE b.ProductID IS NULL;

Niciun comentariu:

Trimiteți un comentariu