我需要創建一條SQL語句,它將從多個表中獲取以下信息: ISBN,Quantity,OrderTotal,FirstName,LastName,PhoneNumber和StreetAddress。MS-Access中的子查詢
這裏有兩個查詢我到目前爲止,給我我需要的信息:
CustomerInfo
SELECT c.CustomerID, c.FirstName, c.LastName, c.PhoneNumber, a.StreetAddress
FROM Customers AS c, Address AS a
WHERE c.CustomerID = a.CustomerID;
OrderInfo的
SELECT o.CustomerID, o.OrderTotal, i.ISBN, i.Quantity
FROM Orders AS o, OrderItems as i
WHERE o.OrderID = i.OrderID;
CombinedQuery釷是不行的!
SELECT c.FirstName, c.LastName, c.PhoneNumber, c.StreetAddress, o.OrderTotal, o.ISBN, o.Quantity
FROM CustomerInfo as c, OrderInfo as o
WHERE c.CustomerID = o.CustomerID;
如何加入前兩個查詢到一個查詢,將提供相同的信息,第三查詢應提供?
什麼「不起作用」? –