FooKelvin Posted October 23, 2015 Share Posted October 23, 2015 Hello, I have a question regarding SQL. Please refer my attachment below: This view of table give me correct of the output. Which give me 36 of results. Please refer attachment below: 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: 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 More sharing options...
benanamen Posted October 23, 2015 Share Posted October 23, 2015 Post your code Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524118 Share on other sites More sharing options...
FooKelvin Posted October 23, 2015 Author Share Posted October 23, 2015 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 Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524119 Share on other sites More sharing options...
benanamen Posted October 23, 2015 Share Posted October 23, 2015 (edited) Can you post an sql dump of your DB? What database are you using? You posted to the Mysql help. I dont think you are using Mysql. Edited October 23, 2015 by benanamen Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524120 Share on other sites More sharing options...
Barand Posted October 23, 2015 Share Posted October 23, 2015 That looks very much like MS SQL Server to me. Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524123 Share on other sites More sharing options...
FooKelvin Posted October 23, 2015 Author Share Posted October 23, 2015 Question Posted: http://forums.phpfreaks.com/topic/298790-ms-sql-join-view-table-help/ Thank You everyone. Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524125 Share on other sites More sharing options...
Barand Posted October 23, 2015 Share Posted October 23, 2015 Don't post the same question in different forums. Closing this one. Link to comment https://forums.phpfreaks.com/topic/298789-database-view-table-wrong-output/#findComment-1524129 Share on other sites More sharing options...
Recommended Posts