We don't need that subquery for group by ref and alike here.
Attach a file by drag & drop or click to upload