Reimplemented querry-6 using left join and group by