Hive Order by Not working Hive Order by Not working hadoop hadoop

Hive Order by Not working


Maybe you can also select the accountid column for sorting.

SELECT accountid,concat('test_',ACCOUNTID) from table order by accountid;

Or, rename "concat('test_', accountid) " as accountid, like this:

SELECT concat('test_',ACCOUNTID) accountid from table order by accountid;


Depends on what you're trying to achieve. If you want your concatenated results to appear in the order of account id then you can expose ACCOUNTID in the projection list

SELECT concat('test_',ACCOUNTID), ACCOUNTID FROM <table> ORDER BY ACCOUNTID


As per my knowledge,its the only way to use alias-name for function expression and use clauses like 'Group By','Order By','Sort By' using that alias-name.