how to count the distinct of a column value
if the column values are
2
3
4
2
then the count should be 3
how to acheive this in datastage other than DB2
how to get the distinct count
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 31
- Joined: Tue Jul 13, 2004 5:26 am
- Location: chennai
- Contact:
how to get the distinct count
Lakshmi
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Use an Aggregator stage. Group your column and count your column.
Refer to Chapter 17 of Parallel Job Developer's Guide (parjdev.pdf) for information on how to use this stage type. It works best if the input data are sorted.
Refer to Chapter 17 of Parallel Job Developer's Guide (parjdev.pdf) for information on how to use this stage type. It works best if the input data are sorted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 31
- Joined: Tue Jul 13, 2004 5:26 am
- Location: chennai
- Contact:
I tired this with too different aggregators thats working fine, whether i can acheive this in a single aggregator.
I tired it with converting the input column to double and having the same coulmn in both group by and count column too. It worked but output i got is not what is expected for distinct count
wht can i do?
I tired it with converting the input column to double and having the same coulmn in both group by and count column too. It worked but output i got is not what is expected for distinct count
wht can i do?
Lakshmi
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 31
- Joined: Tue Jul 13, 2004 5:26 am
- Location: chennai
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In DataStage you need two Aggregator stages.
In most databases you need two separate queries.
Red Brick is the only database of which I am aware that allows multiple DISTINCT clauses in the one SELECT query. But, then, it's designed for data warehouse (business intelligence) queries.
In most databases you need two separate queries.
Red Brick is the only database of which I am aware that allows multiple DISTINCT clauses in the one SELECT query. But, then, it's designed for data warehouse (business intelligence) queries.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.