Adding where clause in LEFT OUTER JOIN giving unexpected result
That's because you violated the rule, that every column in the select clause has to be either in the group by clause or have an aggregate function applied to it. 

When you don't follow this rule, a random for every group is chosen to display. The group by "collapses" the rows for each group and you have to specify which row to display with min(), max() or whatever aggregate function works for you.

MySQL is to my knowledge the only RDBMS that allows violating this rule, but you can turn this off by setting the sql mode only_full_group_by.


read more about it here