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
Post a Comment