TABLE
: Customer
KEY
:- CustomerID
Other
columns: Name, age, etc TABLE
: Customer_address
Keys
: AddrerssID, CustomerID
Other
columns: Street, city, STATE, etc
Please give me ALL customers. I also want to see the customer address if the state = FL
. Only create one SQL statement. The SQL below starts this way. Please fill in the rest.
请给我所有客户。如果州= FL,我也想查看客户地址。只创建一个SQL语句。下面的SQL以这种方式启动。请填写其余部分。
2 个解决方案
#1
1
SELECT C.CustomerID, C.Name, C.Age, CA.AddressID, CA.Street, CA.City, CA.State
FROM Customer C
LEFT JOIN Customer_Address CA ON C.CustomerID = CA.CustomerID AND CA.State = 'FL'
#2
0
select Customer.*,
street,
city,
state
from Customer
left join Customer_address on Customer.CustomerID = Customer_address.CustomerID
and Customer_address.STATE = 'FL'
#1
1
SELECT C.CustomerID, C.Name, C.Age, CA.AddressID, CA.Street, CA.City, CA.State
FROM Customer C
LEFT JOIN Customer_Address CA ON C.CustomerID = CA.CustomerID AND CA.State = 'FL'
#2
0
select Customer.*,
street,
city,
state
from Customer
left join Customer_address on Customer.CustomerID = Customer_address.CustomerID
and Customer_address.STATE = 'FL'