• My thought is t3.code4=1 is unique and therefore the count will never be more than the base table (t1) so I agree you can remove that left join for count purposes as it will never be more than the count of t1.