sql - hive group by and order by collect list -


select b.name, count(b.items) count, concat_ws('|',collect_list(b.items)) items (select distinct name,items,item_rank sourcea)b group b.name order b.item_rank

error invalid column reference item_rank

try output nameofperson,count(items),list of items (pen,paper,book..) @ output order should maintained item_rank in ascending order

example : pen item_rank 1, paper item_rank 2, book item_rank 3

item order should in ascending per rank pen, paper,book in collect_list

my output of collect_list screwed pen,book,paper, not following rank when keep order inside subquery

if keep order outside error invalid column reference item_rank

where going wrong

thanks


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -