hadoop - invoice, colour, type, count -
i have table below:
invoice| colour | type in_001 | red | d in_001 | red | d in_001 | yellow | e in_002 | red | h
my desired result sort out invoice has more 2 items purchased , show count.
see below, desired result:
invoice | colour | type | count in_001 | red | d | 2 in_001 | yellow | e | 1
remark: in_002 not included due fact that, has 1 item purchased.
i tried following command:
select invoice, colour, type, count(invoice) t group invoice,colour,type having count(invoice)>1;
the result is:
invoice | colour | type | count in_001 | red | d | 2
please help.
the group 3 invoice,colour , type. result only. can try below query achieve it:-
select invoice,colour,type,count(invoice) t invoice in (select invoice t group invoice having count(invoice) >1) group invoice,colour,type
Comments
Post a Comment