I need to use group by because I am using other queries with union function.

Thanks,