Sql 接合
我正在尝试连接此表并连接另外两个表。Sql 接合,sql,join,concat,Sql,Join,Concat,我正在尝试连接此表并连接另外两个表。 我的输出应该包含以下列:客户全名(名字和姓氏)、产品说明、订购数量 Table Name Customers: CustomerId FirstName Lastname City State 假设客户id或产品id都不能为空,则进行内部联接 SELECT C.FirstName + ' ' + C.LastName AS [FullName], P.Description AS [ProductDescription],
我的输出应该包含以下列:客户全名(名字和姓氏)、产品说明、订购数量
Table Name Customers:
CustomerId
FirstName
Lastname
City
State
假设客户id或产品id都不能为空,则进行内部联接
SELECT C.FirstName + ' ' + C.LastName AS [FullName],
P.Description AS [ProductDescription],
O.Quantity AS [QuantityOrdered]
FROM Orders O
JOIN Customers C
ON C.CustomerId = O.CustomerId
JOIN Products P
ON P.ProductId = O.ProductId
Table: Products
ProductID
Description
Quantity
SELECT C.FirstName + ' ' + C.LastName AS [FullName],
P.Description AS [ProductDescription],
O.Quantity AS [QuantityOrdered]
FROM Orders O
JOIN Customers C
ON C.CustomerId = O.CustomerId
JOIN Products P
ON P.ProductId = O.ProductId