mysql error: 1054. Unknown column'mover_almox.cod_promob 'in 'Where clause' even if I am not using this column in the parameters

Asked

Viewed 699 times

1

I am trying to make an Insert in my database with the following command:

UPDATE movimentacao_almox SET quantidade = 100, qtd_pendente = 2 WHERE id = 1113;

but I get this mistake:

Error Code: 1054. Unknown column 'movimentacao_almox.cod_promob' in 'where clause'

As you can see, I don’t use this column movimentacao_almox.cod_promob at my command. I would like to understand what is happening and how to solve.

  • Would it be possible to provide more context for the error you are experiencing? Do you have any other query running at this time?

  • Well remembered. tem uma trigger no Before Update: UPDATE cadastro_mp SET estoque_atual = old.movimentacao_almox.quantidade + new.movimentacao_almox.quantidade 
WHERE 
cadastro_mp.cod_promob = movimentacao_almox.cod_promob AND cadastro_mp.almoxarifado = movimentacao_almox.almoxarifado; END

  • There’s probably your problem so he’s not finding this cod_promob before updating your registration.

  • The strange thing is that the column exists in all tables referenced.... I will try to change Before by After update

  • See there and confirm us... ;)

  • It worked!! I’ll post the changes I made in response! Thank you

  • Great guy! Let’s go another... ;D

Show 2 more comments

1 answer

1


Joel reminded me that there was one more query being run along with the code above, which is a Trigger Befor Update:

UPDATE cadastro_mp SET estoque_atual = old.movimentacao_almox.quantidade + 
new.movimentacao_almox.quantidade WHERE cadastro_mp.cod_promob = 
movimentacao_almox.cod_promob AND cadastro_mp.almoxarifado = 
movimentacao_almox.almoxarifado;

i didn’t need to specify the table name again old.movimentacao_almox.quantidade, was just old.quantidade. I did it in the rest of the code and it worked!

Browser other questions tagged

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