- SQL Server - you can use
DATEDIFF
function that returns difference in specifiedDATEPART
SELECT DATEDIFF(dd,'1/20/2014,'1/22/2014')
http://technet.microsoft.com/en-us/library/ms189794.aspx
- MySQL -
DATEDIFF()
just a little bit differently,
SELECT DATEDIFF('2008-11-30','2008-11-29') AS DiffDate
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_datediff
- H2 -
DATEDIFF
DATEDIFF('YEAR', T1.CREATED, T2.CREATED)