1
Good afternoon, I have a table called Pessoa
and another Matricula
, I need to make a query that returns the fields to me name, license plate and person of them, where name and person are on the table Pessoa
and enroll in the table Matricula
to return in select that each informed letter will fetch in the BD by passing the informed letters.
Example 1
He will make the query as he enters the letters.
This select is as follows, working for what you need in another field.
SELECT seq_pessoa AS id
, UPPER(nome) AS text
FROM pessoa
WHERE nome ILIKE '%". $nome ."%'
Doubt
But now I have the following select that is not working properly
SELECT m.matricula AS id
, UPPER(p.nome) AS text
FROM matricula as m
JOIN pessoas as p USING (seq_pessoa)
What I need is instead to enter the user’s name, enter the registration code and it return me his name.
Like the table
matricula
andpessoas
connect? What foreign key?– Pedro Paulo
@Pedropaulo PK table
Pessoa
is theseq_pessoa
, she who connects theMatricula
– Guilherme Rigotti