Return rows with a column that tells how many times id is in another table
I have 2 tables. I want to return everything from Table1 where ItemId=2. I want to add one column CountUnits that tells how many times UnitId exists in Table2. How do I write a stored procedure for this?