IsNull with aggregate functions

SELECT  t1.run
,ISNULL((SELECT COUNT(t2.errors) FROM table2 t2 WHERE t2.run = t1.run ), 0) as errors
FROM table1 t1

Leave a comment