Jump to content

Recommended Posts

Hello,

 

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

 

post-179514-0-65515900-1445587122_thumb.jpg

 

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

 

post-179514-0-03333500-1445587486_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-89802700-1445587771_thumb.jpg

 

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

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/
Share on other sites

Post your code

 

first query which give me correct outputs:

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')

2nd query that gives me wrong output:

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')

Please Help..Thank You

Guest
This topic is now closed to further replies.
×
×
  • 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.