- table1 :id,year,month,...
- table2 :id,date,...
What I am trying to do is to retrieve the distinct values of months from both tables for a specific year (example:2017) and for a specific id(note that table1 have year and month as separate fields while table2 have a complete date as a single field)
I wrote this query:
SELECT DISTINCT month
FROM table1
JOIN table2
ON table1.month = table2.(to_char(date,'mm'))
WHERE table1.year=2017
AND id=406;
I am getting this error:
ORA-01747: invalid user.table.column, table.column, or column specification
01747. 00000 - "invalid user.table.column, table.column, or column specification"
as for the scenario, table1 contains a piece of pay element and table2 contain another pay element, an employee could have an entry in both for the same month or a unique entry in one of the tables for another month, the issue is that I need to count the number of months paid out of 12 (I do not want the same month to be repeated)