I want to create a calculated field within a table. I’ve tried to use a query to do this but it doesn’t work. I think I’m using the wrong function to get the date / year from the date. The error message suggests I read the user manual but I honestly do not know where to find the manual
SELECT Participant.firstname, Participant.lastname, Participant.gender, Participant.DOB,
YEAR(GETDATE())-YEAR(Participant.DOB)-5 AS Participant.schoolyear, Participant.house
FROM Participant
Is there anyway to do this in SQL? I am a high school teacher, teaching this software to a info systems class. They are not familiar with javascript and when I previously taught Access we could do this using SQL.
SELECT
FirstName,
LastName,
Gender,
DOB,
YEAR(NOW()) - YEAR(DOB) - 5 AS SchoolYear,
House
FROM
Participant
The issue with your SQL is the use of GETDATE() which isn’t available in MySQL. I have replaced this with NOW()
I have set up a sample application for you with the table, a standard form, the above query, a data view and a form using the query as the data source which I am happy to share with you. Please let me know which version of Five you are running which you can get by clicking on the profile button in the top right hand corner and then clicking on the Five logo.
You will be glad to know there is not one line of JavaScript in the applcation!