Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
venkatbza
Creator
Creator

Group by in script

Hi Friends,

i need a help in creating a group by expression

below is my table.

Tmp:

load

Salesorder,

Material,

from xyz.qvd;

 

in that table i need to create a one more column called count of material. so my final out put will be Salesorder,Material,materialcount from the table.

I have created a below script, but it is giving duplicate records. please help me my approach is correct or not.

Tmp:

load

Salesorder,

Material,

count(Material) as materialcount,

from xyz.qvd group by Salesorder,Material;

 

Thanks,

Venkat

1 Solution

Accepted Solutions
Taoufiq_Zarra

May be :

Tmp:

load

Salesorder,

Material

from xyz.qvd;

output:
noconcatenate

load Salesorder,Material,count(Material) as materialcount resident Tmp group Salesorder,Material;
left join load * resident Tmp;

drop table Tmp;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

May be :

Tmp:

load

Salesorder,

Material

from xyz.qvd;

output:
noconcatenate

load Salesorder,Material,count(Material) as materialcount resident Tmp group Salesorder,Material;
left join load * resident Tmp;

drop table Tmp;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
agigliotti
Partner - Champion
Partner - Champion

your script looks good to me.
What do you mean with "duplicate records" ??