Home >Database >Mysql Tutorial >MySQL UPDATE Error: Why 'Unknown Column in 'field list''?

MySQL UPDATE Error: Why 'Unknown Column in 'field list''?

Barbara Streisand
Barbara StreisandOriginal
2025-01-14 10:20:44563browse

MySQL UPDATE Error: Why

MySQL UPDATE query error: Unknown column in field list

When executing an UPDATE query in MySQL, you may encounter error code #1054, indicating an unknown column in the field list. This usually happens when the query syntax is incorrect.

Question:

The following UPDATE query triggers this error:

<code class="language-sql">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</code>

Solution:

The solution lies in using quotes for the value assigned to the fellow column. In MySQL, backticks (`) are used to enclose column names, and double or single quotes (' or ") are used to enclose values. By using single or double quotes around the value 'y' in the query, This error can be solved

.

Corrected query:

<code class="language-sql">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</code>

The above is the detailed content of MySQL UPDATE Error: Why 'Unknown Column in 'field list''?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn