Problem with months_between

Creating tables and queries

Problem with months_between

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

Hello

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
Krishna1944
 
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:
Image

That database is documented here: http://www.hsqldb.org/doc/1.8/guide/ch09.html
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, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26635
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 2 guests