Fix SQL for many targets & ordering & disable grouping