Problem with months_between

Creating tables and queries

Problem with months_between

Postby Krishna1944 » Tue Feb 19, 2019 4:30 am


I am having problem in months between function.

Query :- Calculate the age of student.
select stu_name,months_between(sysdate,stu_birth_date)/12 from stu_mast;

Error :- The data content could not be loaded.

Access is denied: MONTHS_BETWEEN in statement [select stu_name,months_between(sysdate,stu_birth_date)/12 from stu_mast;]

Please give me solution of this query.
OpenOffice 4.1.4 on Windows 7
Posts: 2
Joined: Mon Feb 18, 2019 5:39 am

Re: Problem with months_between

Postby Villeroy » Tue Feb 19, 2019 10:59 am

If this is an embedded HSQLDB, the statusbar looks like this:

That database is documented here:
It comes with function DATEDIFF. Try this:
Code: Select all   Expand viewCollapse view
SELECT "stu_name", DATEDIFF( 'month', "stu_birth_date", CURRENT_DATE) from "stu_mast"
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Posts: 29107
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 5 guests