ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Select records from multiple Tables using Join in SQL Server<p>Hi <a class="username" rel="suhaas121"> suhaas121</a>,</p> <p>Refer below sample query.</p> <p><span style="text-decoration: underline;"><strong>SQL</strong></span></p> <pre class="brush: sql">DECLARE @tblBookNode_Amm AS TABLE(iNodeId INT, iBookId INT, iChapterId INT, iModuleId INT,vcFilePath VARCHAR(MAX), FileUploadedBy VARCHAR(20)) INSERT INTO @tblBookNode_Amm VALUES(1,1,1,1,&#39;xjkjjksf65465465dsfhjsdh&#39;,&#39;Admin&#39;) INSERT INTO @tblBookNode_Amm VALUES(2,1,1,2,&#39;xjkjjksf65465465dsfhjsdh&#39;,&#39;Admin&#39;) DECLARE @tblBookNode_Ipc AS TABLE(iNodeId INT, iBookId INT, iChapterId INT, iModuleId INT,vcFilePath VARCHAR(MAX), FileUploadedBy VARCHAR(20)) INSERT INTO @tblBookNode_Ipc VALUES(1,2,2,3,&#39;xjkjjksf65465465dsfhjsdh&#39;,&#39;Admin&#39;) INSERT INTO @tblBookNode_Ipc VALUES(2,2,2,4,&#39;xjkjjksf65465465dsfhjsdh&#39;,&#39;Admin&#39;) DECLARE @tblChapter AS TABLE(iBookId INT, iChapterId INT, vcChapterName VARCHAR(MAX)) INSERT INTO @tblChapter VALUES(1,1,&#39;Chapter 00&#39;) INSERT INTO @tblChapter VALUES(2,2,&#39;IPC&#39;) DECLARE @tblModule AS TABLE(iModuleId INT, iChapterId INT, vcModuleTitle VARCHAR(MAX)) INSERT INTO @tblModule VALUES(1,1,&#39;XML and illustrations&#39;) INSERT INTO @tblModule VALUES(2,1,&#39;dummy&#39;) INSERT INTO @tblModule VALUES(3,2,&#39;Sample IPC&#39;) INSERT INTO @tblModule VALUES(4,2,&#39;Sample IPC2&#39;) SELECT mod.vcModuleTitle,Ipc.iNodeId, Amm.iNodeId,Amm.vcFilePath,Amm.iChapterId, Ipc.vcFilePath,Ipc.iChapterId FROM @tblBookNode_Amm Amm INNER JOIN @tblBookNode_Ipc Ipc ON Amm.iNodeId = Ipc.iNodeId INNER JOIN @tblChapter chap on Ipc.iChapterId = chap.iChapterId INNER JOIN @tblModule mod on Ipc.iModuleId = mod.iModuleId</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/150950/Select-records-from-multiple-Tables-using-Join-in-SQL-Server/https://www.aspforums.net:443/Threads/150950/Select-records-from-multiple-Tables-using-Join-in-SQL-Server/Thu, 22 Aug 2019 01:27:38 GMT