For Group By clause, you can't use column alias. Instead, use column index numbers.
For Order By clause, generally, you can use alias or index numbers. But there is one special case. If the Order By clause uses UDFs, then using column index number doesn't work. So, in case of columns, which have function values, use column alias. In rest of the cases, you can use either column number or alias.