Hi,
I have a below requirement.
Below table we are having.
Actually I want group by on stylecode and vendor but wants print turn_around also in output , but in that case it is aggregating based on all three columns which I dont want.How can I get rid from this behaviour?
Stylecode | vendor | turn_around |
1111 | AAA | 5.00 |
1111 | AAA | 4.00 |
2222 | BBB | 6.00 |
2222 | BBB | 3.00 |
2222 | BBB | 4.00 |
Output we need.
Stylecode | vendor | turn_around | COUNT(based on style code and vendor) | SUM(Add turnaround time based on stylecode and vendor) | AVERAGE |
1111 | AAA | 5.00 | 2 | 9 | 4.5 |
1111 | AAA | 4.00 | 2 | 9 | 4.5 |
2222 | BBB | 6.00 | 3 | 13 | 4.3 |
2222 | BBB | 3.00 | 3 | 13 | 4.3 |
2222 | BBB | 4.00 | 3 | 13 | 4.3 |
What I tried with below query and managed to get below result but what i need as above.
select "Stylecode",
"vendor",
avg ("SUM"/"COUNT") as "AVERAGE"
from ( select
"Stylecode",
"vendor",
sum("turn_around") as "SUM",
count("turn_around") as "COUNT"
from "HANA"."HANA_ANA2345"
group by "Stylecode",
"vendor") group by "Stylecode","vendor"
BR
Sumeet