Issue #23760 Fix group by and union by on join table columns