Wednesday, October 15, 2014

#3 Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns:



Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Line1, City, State, ZipCode. Return one row for each customer, but only return addresses that are the shipping address for a customer.

Answer:
SELECT FirstName, LastName, Line1, City, State, ZipCode
FROM Customers JOIN Addresses
ON
Customers.CustomerID = Addresses.CustomerID
AND
Customers.ShippingID = AddressID;


No comments:

Post a Comment