I'm trying to search for the records of a column called "Students" in table1: if the records are not found in table1 then I should search for them in table2.
Note: Table1 and table2 have this column called "Students" in common.
The expected result is that it shows me the results that were found in table1 in addition to the results that I search for and found in table2, but I don't know if this query is well structured, is there a statement that should be implemented?
I have the following SQL code:
select Alumnos
from tabla1
where Alumnos in (
select Alumnos
from tabla1 a
where not exists(select Alumnos
from tabla2 b
where a.Alumnos = b.Alumnos)
group by Alumnos)