我需要使用SQL Server Management Studio 查询设计器构建我的查询
tbl_B.Name + tbl_C.Name + tbl_D.Name
如果Id
intbl_E/tbl_User
等于UserId
in ,我需要显示一个串联的字符串tbl_A
这是表结构 https://imgur.com/PZagLPq , https://imgur.com/moE4dcf
tbl_A UserId = Id in tbl_E/tbl_User
tbl_B_Id = Id in tbl_B
tbl_C_Id = Id in tbl_C
tbl_D_Id = Id in tbl_D
我尝试了下面的代码,但没有显示来自 tbl_B、tbl_C 和 tbl_D 的名称字段
SELECT tbl_B.Name AS Expr1, tbl_C.Name AS Expr2, tbl_D.Name AS Expr3, tbl_A.UserId, [tbl_E].Id AS Expr5
FROM tbl_B
INNER JOIN tbl_D ON tbl_B.Id = tbl_D.Id
INNER JOIN tbl_A ON tbl_B.Id = tbl_A.Id
INNER JOIN tbl_C ON tbl_B.tbl_CId = tbl_C.Id AND tbl_D.Id = tbl_C.tbl_DId
INNER JOIN [tbl_E] ON tbl_B.Id = [tbl_E].Id AND tbl_A.UserId = [tbl_E].Id
WHERE (tbl_A.UserId = [tbl_E].Id)