I have two date columns , i have to find the date difference between sysdate and call_date the difference should be in months. i have to find the difference if it is more than 4 months i have to use the difference in where clause.
i have tried like
sel cast((date-call_dt as interval month(2)) as promt from table name where prompt > 4
is there any function in teradata sql assistant by which this can be done.
Re: finding date difference of two dates in months
select extract(month from sys_date) sys_month, extract(month from call_date) call_month, extract(year from sys_date) sys_year, extract(year from call_date) call_year, cast((sys_year-call_year) as integer) diff_year, ( case when (diff_year < 1) then (sys_month-call_month) else cast(((diff_year*12)+cast((sys_month-call_month) as integer)) as date) end ) diff_month from table_name where cast(diff_month as integer) > 4