Hi all,
In one of my requirements i have to find the Max of two dates which are coming from the same input link and got to pass the max value to the output.
If i am not wrong Max() functions works for integer datatypes...Is there any way around to get this...
Finding max of date
Moderators: chulett, rschirm, roy
Finding max of date
Thanks and Regards!!
dspxlearn
dspxlearn
-
- Participant
- Posts: 57
- Joined: Wed Jan 26, 2005 10:22 pm
- Location: India
I would have expected that a comparison of two variables of type DATE or TIMESTAMP would work - have you tried it? If it doesn't function, then you need to cast the data into a numeric (julian conversion) or a string (formatted YYYYMMDD for collation) so that you can do a comparison.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi ArndW,
Thanks for your earlies reply......
Can you be please more specific....
Let me give my requirement with an example...
Suppose i have a field A which will have two date records with data type Date...
2005-11-21
2005-11-22
The two records i will get from the same column...From this column i need to take the most recent data and i need to pass only this record to the output column....
If i am not wrong
If Link1.col1 > Link1.col1 then Link1.col1 is what you said right...In this case i dont which record will come first....right...
Thanks for your earlies reply......
Can you be please more specific....
Let me give my requirement with an example...
Suppose i have a field A which will have two date records with data type Date...
2005-11-21
2005-11-22
The two records i will get from the same column...From this column i need to take the most recent data and i need to pass only this record to the output column....
If i am not wrong
If Link1.col1 > Link1.col1 then Link1.col1 is what you said right...In this case i dont which record will come first....right...
Thanks and Regards!!
dspxlearn
dspxlearn
I misunderstood your original post, I thought you wanted to do a comparison of fields in one row, but you wish to do this across more than one row. In this case the approach is different. If you only have 2 rows across which you want to find the highest, then you can use stage variables to store the previous value and use a comparison; but if your requirements are more complex you will need to use an aggregator (which has builtin MIN/MAX functions).
The question is do you want a MAX of any date in the whole input file, or are you trying to get a maxiumum date in a grouping of records?
The question is do you want a MAX of any date in the whole input file, or are you trying to get a maxiumum date in a grouping of records?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>