[Solved] Query to return age as of December 31
Posted: Tue Jan 22, 2019 9:45 pm
I am attempting to run a query that will return a person's age on December 31 of the prior year. The following query returns the values I am looking for.
"SELECT ""DOB"", DATEDIFF('yy',""DOB"",'2018-12-31') As ""Age"" FROM ""tblDependents""
To make the query run without editing in future years, I would like to replace the hard-coded '2018-12-31' with a function that returns the last day of the prior year.
I am running Base with the default HSQL database engine.
Thank you for your help.
"SELECT ""DOB"", DATEDIFF('yy',""DOB"",'2018-12-31') As ""Age"" FROM ""tblDependents""
To make the query run without editing in future years, I would like to replace the hard-coded '2018-12-31' with a function that returns the last day of the prior year.
I am running Base with the default HSQL database engine.
Thank you for your help.