c# - SQL: Count rows which are not present in table -
i got 2 tables called: employeetable & taskassignmenttable. :
taskassignmenttable shows tasks assigned employees. in order assign new tasks employees want have count of tasks assigned different people , assign task people have least tasks assigned.
problem: using normal count() on taskassignmenttable results in table:
but want sort of join between tables shows count of rows present in first table , absent in 2nd table count equal 0 one:

so sql query join tables , such thing? (optional: since i'm using c# linq-2-sql grateful if can write linq syntax this).
you need left outer join based upon statement want rows present in first table not second:
select employeeid, name, count(taskid) cnt employeetable e left join taskassignmenttable t on e.employeeid = t.fkemployeeid group employeeid, name
Comments
Post a Comment