I need to get the count of ID_Tag per BoxNo as result. Condition
- List all BoxNo and subtract the count if the ID_Tag appears in table 2.
- If BoxNo has 0 tags after subtraction do not display in the result
SQL Query I have tried
Select tb1.BoxNo, Count(tb1.ID_Tag) - Count(tb2.DelID_Tag) As NumberOfTags From Table1 tb1 Left Outer Join Table2 tb2 on tb1.ID_Tag = Tb2.DelId_Tag Group By tb1.BoxNo
I get the list of all the BoxNo with the count from Table1.