Work with JOIN
to join the 2 tables as they have in common the id_type
and to filter by a specific value that you use where
to define where you want the search to be made.
From the perspective of a Cartesian plane, the use of JOIN
or also known as INNER JOIN
will return the results that are linked in both tables; that is, in a scenario where a users table is linked to a posts table; this same JOIN
will return all the users who have registered posts, omitting both the users without posts or the posts without users
** EXAMPLE **
SELECT types.name, plates.name
FROM types
JOIN plates ON types.id = plates.id_type
WHERE plates.id = 1;
The value 1 that you replace with the variable or the exact value
that you want me to help filter your search; preferably for each field that you consult precedes it by the name of the table to which it belongs to avoid ambiguities; in this way: tablaName.columnaName