Saturday, January 8, 2011

Get maximum date from two different columns in a new columnn


if you want to get maximum date from two different columns you can like this:

select date1,date2,( (date1<date2)*date2 + (date2<date1)*date1 ) as maxdate
from table1.


if you want maximum date from field date1 and date2 and store into field date3 then you can use this formula:

update table1
set date3= ( (date1<date2)*date2 + (date2<date1)*date1 )

No comments:

Post a Comment