0

I am trying to select those faculty rows which have the same month of birth as that of students, but this code doesn't seem to work. "SQL Error: ORA-00904: "MONTH": invalid identifier" is the error being displayed.

SELECT STUDENT.FIRSTNAME, STUDENT.DOB, FACULTY.FIRSTNAME, FACULTY.DOB
FROM STUDENT, FACULTY
HAVING MONTH(STUDENT.DOB) = MONTH(FACULTY.DOB);
2
  • Try changing having to where (or moving it to an actual join -- generally I recommend avoiding commas in your from clause)... If that doesn't work, post sample data and expected results. Commented Oct 3, 2016 at 0:47
  • What sgeddes said, and also the syntax is extract(month from student.dob). Commented Oct 3, 2016 at 0:58

1 Answer 1

1

You can Try this:

SELECT STUDENT.FIRSTNAME, STUDENT.DOB, FACULTY.FIRSTNAME, FACULTY.DOB
FROM STUDENT, FACULTY 
where
extract(month from STUDENT.DOB)=extract(month from FACULTY.DOB)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.