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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -