ken macharia
ken macharia

Reputation: 71

MySQL Error Code: 1054 Unknown column 'field' in 'field list'

I keep getting

Error Code: 1054 Unknown column 'originalFieldName' in 'field list'

when trying to insert a new record to a table. This still happens even when I am not inserting any value to this problematic column 'originalFieldName'. Renaming the field and ensuring I don't have unprintable characters like suggested in solutions to this question does not help either.

I have since reduced my query to INSERT INTO incoming(receiptDate) VALUES(NOW()); and deleted some fields to remain with below table: table description but this error 1054 keeps popping up

Upvotes: 3

Views: 17965

Answers (2)

ken macharia
ken macharia

Reputation: 71

The error was caused by a trigger which was doing a comparison on 'originalFieldName'. I had forgotten to specify it as new.originalFieldName to refer to the newly inserted value in that field and thus MySQL reported it as unknown column.

Upvotes: 4

Manish Kumar
Manish Kumar

Reputation: 589

Are you using mysql ? If you are using mysql then there could be a difference in back tick ( `someValue ` ) . Keep considering this point and see if it helps . If you are using other DB then please let me know . It seems some invisible characters has been introduced there . May be you have copied it from somewhere . Please let me know DB details and paste full code.

Upvotes: 0

Related Questions