on 08-12-2017 8:31 AM
Hi Experts,
I have a below requirement, kindly help me to fix this.
Col A Col B
SAP ABAP
SAP ABAP
SAP SD
SAP HANA
when I use aggregation for the above table and make column B as aggregated column and aggregated type as "COUNT" am getting count value as 4 for SAP.
It providing me the total row count for SAP in the output. where as the expected count value should be "3". Since row 1 and 2 are duplicates.
Can someone help me, how to achieve the Count value as "3" for SAP in Output.
Thanks
Rufus Samuel
You can do an aggregation before the aggregation you describe. The additional aggregation just needs both fields (as "normal" fields, not as aggregated ones) to eliminate duplicates.
Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SELECT COUNT(DISTINCT(row_2)) FROM <SCHEMA>.TABLE
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please refer below
This is my table
Thanks,
Shanthi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.