Jump to content

MS SQL Join View Table. HELP


FooKelvin
 Share

Recommended Posts

Hello,


 


I have a question regarding SQL. Please refer my attachment below:


post-179514-0-68351500-1445597103_thumb.jpg


 


Query 1:



SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup,
dbo.subgrouptbl.subgroupName
FROM dbo.[evaluation[Submit]]] INNER JOIN
dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN
dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN
dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID
WHERE (dbo.[evaluation[Submit]]].EmpID = '00001')

This view of table give me correct of the output. Which give me 36 of results. Please refer attachment below:


post-179514-0-40582600-1445597108_thumb.jpg


 


But, when i try to put additional table which i need to indicated whether the form is completed or draft, it's because i do not want to show "draft" form in the table.


 


Have a look on the table below:


post-179514-0-35599200-1445597110_thumb.jpg


 


After i added this table into my view, the output is repeated 2 times and give me 72 of results. 


Query 2:



SELECT dbo.[evaluation[Submit]]].FormID, dbo.empDB.Name, dbo.FormTbl.FormName, dbo.[evaluation[Submit]]].groupName, dbo.[evaluation[Submit]]].subGroup,
dbo.subgrouptbl.subgroupName, dbo.EmployeeDetails.submissionStatus
FROM dbo.[evaluation[Submit]]] INNER JOIN
dbo.empDB ON dbo.[evaluation[Submit]]].EmpID = dbo.empDB.EmployeeID INNER JOIN
dbo.FormTbl ON dbo.[evaluation[Submit]]].FormID = dbo.FormTbl.FormID INNER JOIN
dbo.subgrouptbl ON dbo.[evaluation[Submit]]].subGroup = dbo.subgrouptbl.subgroupID INNER JOIN
dbo.EmployeeDetails ON dbo.empDB.EmployeeID = dbo.EmployeeDetails.EmpID
WHERE (dbo.[evaluation[Submit]]].EmpID = '00001')

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.