Monthwise difference between two dates(timestamp)
select
(
(DATE_PART('year', AgeonDate) - DATE_PART('year', tmpdate)) * 12
+
(DATE_PART('month', AgeonDate) - DATE_PART('month', tmpdate))
)
from dbo."Table1"
Yearwise difference between two dates(timestamp)
select (DATE_PART('year', AgeonDate) - DATE_PART('year', tmpdate)) from dbo."Table1"