Page 1 of 1

Need help in the logic

Posted: Wed Dec 05, 2018 8:24 pm
by synsog
Need help in below topic

input data

Col1(Timestamp) Col2(timestamp)

2017-12-31 10:05:06 | 2017-12-31 10:05:06
2018-01-01 07:20:05 | 2018-01-01 07:23:05
2018-01-01 07:22:05 | 2018-01-01 07:25:05
2019-01-01 06:00:04 | 2019-01-01 06:00:05

output needed

2017-12-31 10:05:06 | 2017-12-31 10:05:06
2018-01-01 07:20:05 | 2018-01-01 07:25:05
2019-01-01 06:00:04 | 2019-01-01 06:00:05

we have to compare col1 and col2, if col1 timestamp falls between col2 for exp shown above 2 and 3 rd record need 2nd record as op

Thanks in advance..

Posted: Wed Dec 05, 2018 8:53 pm
by chulett
So... you need to collapse multiple records over a single day down to a single record and min/max the timestamp? If so - what are your thoughts, what have you tried? If not - please clarify.

Posted: Thu Dec 06, 2018 6:02 am
by qt_ky
I don't get it. Are you comparing values across multiple records???

Posted: Thu Dec 06, 2018 7:45 am
by synsog
i using datastage transformer for saving off the values with stage variables and looping based on above..is it way of doing it?

Posted: Thu Dec 06, 2018 8:51 am
by chulett
Yes. It is a way.

Posted: Sun Dec 09, 2018 6:45 pm
by ray.wurlod
I'd use an Aggregator stage if all that is required is the grouping columns and the minimum and maximum value per group.

Posted: Mon Dec 10, 2018 6:44 am
by chulett
That is a way as well. :wink:

Just make sure you group on the date and not the full timestamp.