I have the problem of creating a nested query to generate pagination with results that I have to obtain from 2 different tables:
some table records
what I need to do in the query is to select 5 records (by pagination) from the record table with the status "PENDING" but only those that belong to a teacher, for example "Sandra" I hope I explained myself well, thanks
The simplest way to understand would be using a subquery:
What you have in common is the column
matricula
that is present in both tables, so if you know which license plates belong to "Sandra" and look at the records associated with that license plate, you will get the result you are looking for:Obtain the registrations in which "Sandra" is a teacher:
This query returns the license plates, so now you just have to find which records have these license plates.
Inner Join can also be used .