2
I didn’t find the question very clear, but I understood what you want to do, as some information is missing I believe you want to compare the information in the table. For this there is a command called EXISTS
SELECT CIDADE FROM PESSOA P
WHERE EXISTS
(SELECT * FROM GMUNICIPIO WHERE P.CIDADE = GMUNICIPIO.NOMEMUNICIPIO)
When a subconsultation is displayed with the keyword EXISTS, the subconsulta acts as a test of existence. The WHERE clause of external query tests if the lines returned by the subconsulta exist. The subconsultation does not actually produce any data; it returns a value TRUE or FALSE.
Check : https://technet.microsoft.com/pt-br/library/ms189259(v=sql.105). aspx
Ball show Lucas, mt thanks
– Marcilio Eloi