-1
I have a structure for view
in the database. And when executing, the error is that c3.nome
does not exist. But exists in the database, I believe it is on account of subquery
. How to proceed?
SELECT
c1.quantidade,
c1.valor,
c1.data_compra,
c2.razao_social,
c3.nome,
c4.usuario
FROM
ferramental_estoque AS c1
LEFT JOIN fornecedor AS c2 ON c2.id_fornecedor = c1.id_fornecedor
WHERE
c2.situacao IN (
SELECT
*
FROM
fornecedor
WHERE
situacao = '0'
);
LEFT JOIN ativo_externo AS c3 ON c3.id_ativo_externo = c1.id_ativo_externo
LEFT JOIN usuario AS c4 ON c4.id_usuario = c1.id_usuario
these LEFT JOIN should not come before the
Where
?– novic
Beyond what has already been said here
c2.situacao IN (SELECT * FROM fornecedor WHERE situacao = '0' )
your subquery should return only the fieldsituacao
and not all fields in the table, and what is the meaning of this subquery if it will always return '0'?– anonimo