Use joins instead of sub-queries in group by/sort by when using custom fields (#12713).
Sub-queries in group by are not supported by SQLServer.
Authored by: jplang 2013-01-03
Parent: [r11101]
Child: [r11103]