Ferhat Karataş Posted on Oct 28, 2021 • Edited on Dec 15, 2021 How to prevent duplicate count value for inner join #tsql #query #mssql When you join two tables and you want to count only the first table, you can use the distinct command. select a.OrderID, count(distinct a.Id) as Total from tblOrder a inner join tblOrderDetail b on a.OrderID = b.OrderID Enter fullscreen mode Exit fullscreen mode Top comments (0) Subscribe Submit Preview Dismiss Code of Conduct • Report abuse
Top comments (0)