且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL Server INNER JOIN多个内部联接与多个关系

更新时间:2023-01-28 17:33:38

您要这样做:

SELECT TOP 100 
FF.XID, 
FF.YID, 
FF.Title, 
FF.FileName, 
FF.FilePath, 
FU.UserName as FUUserName, 
FU.UserName as BUserName,
FB.BUserName as FB_BUserName
FROM FF 
    INNER JOIN FU ON FU.UserID = FF.UserID 
    INNER JOIN FB ON FB.UserID = FU.UserID

现在, FF 绑定到 FU ,然后绑定到 FB

Now, FF ties to FU, which then ties to FB. As they are all inner joined, you can use the law of association to understand that this acts like they are all linked together.

 FF = FU   FU = FB    Therefore FF = FB