Resolve this database issue

Asked

Viewed 32 times

0

inserir a descrição da imagem aqui

I deduced on doing so, but I believe that with this I only have the information of those who did not trade, could give me a light in this question?

SELECT CR.name
FROM broker as CR
Inner JOIN marketing as C
on CR.matricula = C.matriculaCorretor
WHERE C.matriculaCorretor is null

1 answer

1


With INNER JOIN you only recover what exists in the two tables, ie only those that carried out some commercialization.

In your case use LEFT OUTER JOIN:

SELECT CR.nome, (CASE WHEN C.matriculaCorretor IS NULL THEN 'Não' ELSE 'Sim' END) AS status
FROM corretor as CR
LEFT OUTER JOIN comercialização as C
ON CR.matricula = C.matriculaCorretor;

All brokers with indication whether or not they were commercialized.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.