Unknown column in field list error in MySQL Update query

I keep getting MySQL error # 1054 while trying to execute this update request:

UPDATE MASTER_USER_PROFILE, TRAN_USER_BRANCH SET MASTER_USER_PROFILE.fellow=`y` WHERE MASTER_USER_PROFILE.USER_ID = TRAN_USER_BRANCH.USER_ID AND TRAN_USER_BRANCH.BRANCH_ID = 17 

This is probably a syntax error, but I tried to use the inner join and other changes, but I keep getting the same message:

 Unknown column 'y' in 'field list' 
+105
sql mysql mysql-error-1054
Aug 28 '09 at 10:38
source share
8 answers

Try using different quotation marks for "y", since the identifier quote character is the reverse side ("` "). Otherwise, MySQL "thinks" that you are pointing to a column named "y".

See also MySQL 5 Documentation

+135
Aug 28 '09 at 10:57
source share

Include any string that will be passed to the mysql server inside single quotes; eg:.

 $name = "my name" $query = " INSERT INTO mytable VALUES ( 1 , '$name') " 

Note that although the query is enclosed between double quotation marks, you must enclose any string in single quotation marks.

+41
Dec 29 '09 at 11:45
source share

You can check your choice of quotes (use double / single quotes for values, strings, etc. and backreferences for column names).

Since you want to update the master_user_profile table, I would recommend a master_user_profile :

 UPDATE master_user_profile SET master_user_profile.fellow = 'y' WHERE master_user_profile.user_id IN ( SELECT tran_user_branch.user_id FROM tran_user_branch WHERE tran_user_branch.branch_id = 17); 
+16
Aug 28 '09 at 11:08
source share

In my case, this was caused by an invisible trailing space at the end of the column name. Just check if you are really using "y" or "y".

+4
Oct 21 '16 at 10:26
source share

While working on building a .Net application using EF code, I received this error message when I tried to apply my migration, where I had Sql("UPDATE tableName SET columnName = value"); expression.

Turns out I spelled columnName incorrectly.

+1
Feb 14 '18 at 9:59
source share

A query like thi will also throw an error

 select table1.id from table2 

If the table is listed in the select column and is not included in the from clause.

0
May 16 '17 at 16:58
source share

I got the same error too, the problem is in my case, I included the column name in the GROUP BY , and this caused this error. So I removed the column from the GROUP BY and it worked !!!

0
Jun 28 '18 at 5:55
source share

If it is sleep mode and JPA. check the name of your specified table and the columns may not match

0
Jul 24 '19 at 6:30
source share



All Articles