Error: Multi-part identifier could not be associated

1

I'm trying to run the following command:

SELECT * FROM pendencia, cliente
LEFT JOIN servico ON pendencia.id_pendencia = servico.id_pendencia
LEFT JOIN cidade  ON cliente.id_cidade = cidade.id_cidade
WHERE cliente.id_cliente = pendencia.id_cliente AND servico.ativo = 1

And SQL Server returns me the following error:

Message 4104, Level 16, State 1, Line 2 The multi-part identifier "pendencia.id_pendencia" could not be associated.

I do not know where I'm going wrong, can anyone tell me what's wrong?

Follow the bank schema:

    
asked by anonymous 26.11.2014 / 19:33

1 answer

2

Correct your JOIN or use comma or use with JOIN , LEFT JOIN

Example:

SELECT * FROM pendencia a
JOIN cliente b ON a.id_cliente = b.id_cliente
LEFT JOIN servico c ON a.id_pendencia = c.id_pendencia
LEFT JOIN cidade d ON a.id_cidade = d.id_cidade

So I think it's better not to acknowledge the error, the problem lies in its syntax.

    
05.02.2015 / 14:02