How to get max value of TIME datatype column

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

How to get max value of TIME datatype column

Hi,

 

In my table I have column with datatype TIME(6). When I perform Max operation it gives me wrong value.

After casting to Varchar it gives me correct value. Can someone please explain why it works after casting and why not on TIME(6) datatype.

 

Thanks, 

3 REPLIES
Teradata Employee

Re: How to get max value of TIME datatype column

The comparison for TIME values is based on the internal UTC (GMT) equivalent, but the external value will have the session time zone offset applied.

Enthusiast

Re: How to get max value of TIME datatype column

Thanks Fred. 

So how come varchar gives the correct result ,does it ignore ":" while calculating and also does it implicitly changes from varchar to Integer?

Junior Contributor

Re: How to get max value of TIME datatype column

Try adjusting the time zone to UTC: max(mycolumn at 0)