SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "and" LINE 1: ...cd_deposito = D.cd_deposito where B.id_armazem = and B.stat... ^