Page 1 of 1

count the rows

Posted: Thu Jun 12, 2008 9:36 am
by arshi
Hi,

I have the requirement like,

INPUT

COL1

ABC
ABC
XYZ
ABC
XYZ

I want the OUTPUT as,

COL2 COL3
ABC 3
XYZ 2

Can you tell how to implement in datastage.

Regards,
Arshi

Re: count the rows

Posted: Thu Jun 12, 2008 9:43 am
by gateleys
Aggregate based on Col1 and count.

Posted: Thu Jun 12, 2008 11:38 am
by Minhajuddin
If you have more than one column and you want other columns to be intact, you need to split it using a copy stage aggregate it on COL1 and then join it back with the original stream on COL1

Posted: Thu Jun 12, 2008 11:42 am
by DSguru2B
If your source is a database you can select that column and a count(*) next to it, with the first column in the group by clause.

Posted: Thu Jun 12, 2008 11:47 am
by ag_ram
Minhajuddin wrote:If you have more than one column and you want other columns to be intact, you need to split it using a copy stage aggregate it on COL1 and then join it back with the original stream on COL1
Didn't see that Job type is Server, Minhajuddin.

Posted: Thu Jun 12, 2008 11:57 am
by pranay
use the aggregator stage with columns COL1 and count(COL1).

Posted: Fri Jun 13, 2008 10:43 am
by Minhajuddin
My apologies for giving the wrong solution :oops: