Left join not showing all rows in results

A LEFT JOIN should return all rows from the left table, with the matching rows in the right table. The result is NULL in the right side when there is no match. So how come my query below is not showing all rows from the left table?

Thank you!

SELECT 
	s.summitID,
	s.name,
	count( case when m.type = 'searchMarketing' then 1 else null end ) as 'searchMarketing',
	count( case when m.type = 'accountMarketing' then 1 else null end ) as 'accountMarketing',
	count( case when m.dateSent is not null then 1 else null end ) as 'totalSent', 
	count( case when m.dateClicked is not null then 1 else null end ) as 'totalClicked'
FROM
	summits s
left JOIN
	marketing m
ON
	s.summitID = m.summitID
GROUP BY
	m.summitID
ORDER BY
	s.startDate desc

dod

change your GROUP BY to s.summitID

Thanks r937! Another set of eyes always works wonders when trying to find small mistakes like this.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.