Good day. Please how can I re-write this query below in order to eliminate GROUP BY and not sacrifice performance when the database eventually grows big?