3
Friends,
I am trying to make an app to control investments in shares. In DB of this app I have the table portfolio and active table. I need to make a select that returns to me the active portfolios and the amount of roles (shares) that each portfolio has. It turns out that the portfolio may be active but does not yet contain any action.
made the following consultation:
select c.codigo, c.nome, c.inicio, COUNT(a.codigobovespa) as qtde_papeis
from carteira c inner join ativo a
on c.codigo=a.carteira
where c.ativa = 'S'
group by c.codigo, c.nome, c.inicio
However, despite the query setting the fields correctly, it only returns a portfolio, even active, if it contains a correspondent in the active table. And I need to appear all and zero quantity when there is no corresponding asset in the active table.
Can someone help me with this?!?!