Get max datetime column doing a froup by

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Credit_Inter
Premium Member
Premium Member
Posts: 2
Joined: Wed Sep 30, 2009 9:32 pm

Get max datetime column doing a froup by

Post by Credit_Inter »

I have a job where I need to get the max(datetime_col) with a group by on group_by_col.

I used an aggregator where I gave the group by value as group_by_col and then the sort key as datetime_col.

The problem is that Aggregator only gives a double or a decimal output and not a datetime.

Thanks!
robjones
Participant
Posts: 24
Joined: Tue Nov 18, 2008 3:12 pm
Location: London

Re: Get max datetime column doing a froup by

Post by robjones »

In the Stage / Properties tab of the aggregator stage, under the 'Aggregations' category, try adding the property 'Preserve Type' to the 'Column for Calculation', and set it to 'True'.

This should force the stage to output the result of the aggregation in the datatype of the input column you are aggregating on.
Post Reply