Questions tagged [mysql-error-1054]

ERROR 1054 (42S22): Unknown column 'table.column' in '? clause'

The error message lists the column that MySQL can not find associated to a table.

Resolution

Check the table to confirm that the column actually exists in it.

Related tag

286 questions
268
votes
7 answers

Using column alias in WHERE clause of MySQL query produces an error

The query I'm running is as follows, however I'm getting this error: #1054 - Unknown column 'guaranteed_postcode' in 'IN/ALL/ANY subquery' SELECT `users`.`first_name`, `users`.`last_name`, `users`.`email`, SUBSTRING(`locations`.`raw`,-6,4) AS…
James
  • 2,823
  • 2
  • 17
  • 8
173
votes
14 answers

Unknown column in 'field list' error on MySQL Update query

I keep getting MySQL error #1054, when trying to perform this update query: 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 =…
me_here
  • 2,329
  • 5
  • 19
  • 13
149
votes
16 answers

Unknown Column In Where Clause

I have a simple query: SELECT u_name AS user_name FROM users WHERE user_name = "john"; I get Unknown Column 'user_name' in where clause. Can I not refer to 'user_name' in other parts of the statement even after select 'u_name as user_name'?
Corpo
95
votes
7 answers

Can I reuse a calculated field in a SELECT query?

Is there a way to reuse a calculated field within a mysql statement. I get the error "unknown column total_sale" for: SELECT s.f1 + s.f2 as total_sale, s.f1 / total_sale as f1_percent FROM sales s or do I have to repeat the calculation,…
sdfor
  • 6,324
  • 13
  • 51
  • 61
64
votes
4 answers

MySQL unknown column in ON clause

I have the following MySQL query: SELECT p.*, IF(COUNT(ms.PropertyID) > 0,1,0) AS Contacted, pm.MediaID, date_format(p.AvailableFrom, '%d %b %Y') AS 'AvailableFrom', astext(pg.Geometry) AS Geometry FROM property p, propertygeometry…
Matthew James Taylor
  • 4,806
  • 5
  • 29
  • 33
23
votes
5 answers

How to limit results of a LEFT JOIN

Take the case of two tables: tbl_product and tbl_transaction. tbl_product lists product details including names and ids while tbl_transaction lists transactions involving the products and includes dates, product-ids, customers etc. I need to…
eddy edu
  • 233
  • 1
  • 2
  • 6
23
votes
2 answers

MySQL unknown column 'password_last_changed'

When creating a user using this command: create user 'foo'@localhost'; this error is shown: ERROR 1054 (42S22): Unknown column 'password_last_changed' in 'mysql.user' Using MySQL server version: 5.7.6 I tried to add it but I don't know its…
Ammar Jibarah
  • 251
  • 1
  • 3
  • 4
19
votes
4 answers

MySQL error #1054 - Unknown column in 'Field List'

Whenever I try to input data into my tblorder I get the error message #1054 - Unknown column 'FK_Customer_ID' in 'field list'. I have tried breaking my code down and in doing this I found that the error is repeated for FK_Customer_ID and…
user2852418
  • 377
  • 3
  • 5
  • 13
15
votes
4 answers

MySQL "Unknown Column in On Clause"

I have the following MySQL query: SELECT posts.id, posts.name, LEFT(posts.content, 400), posts.author, posts.date, users.display_name, GROUP_CONCAT(tags.tag ORDER BY tag_linking.pid ASC SEPARATOR ",") update_tags FROM posts, tag_linking,…
Connor Peet
  • 6,065
  • 3
  • 22
  • 32
13
votes
3 answers

MySQL 5 left join unknown column

I had the below query working in mysql 4.1, but does not in 5.0: SELECT * FROM email e, event_email ee LEFT JOIN member m on m.email=e.email WHERE ee.email_id = e.email_id The error: 1054 (Unknown column 'e.email' in 'on clause')
Neil
  • 7,042
  • 9
  • 43
  • 78
10
votes
5 answers

How to use a temp column in the where clause

Why can't I use a temporary column in the where clause? For example, this query: Select product_brand, (CASE WHEN COUNT(product_brand)>50 THEN 1 ELSE 0 END) AS brand_count FROM products WHERE 1 GROUP BY …
JD Isaacks
  • 56,088
  • 93
  • 276
  • 422
8
votes
2 answers

Doctrine Column not found: 1054 Unknown column 's.features' in 'field list''

I added a new column "features" to the site table and regenerated the models using Doctrine. This code is causing an error: $siteTable = Doctrine_Core::getTable("Site"); $site = $siteTable->findOneByName("site"); // this line is throwing an…
rahul
  • 1,423
  • 3
  • 18
  • 28
8
votes
2 answers

MySQL error in Trigger "Unknown column in 'NEW'"

I'm having an inconsistent error with a "before insert trigger" in MySQL and cannot figure out the reason. I Have a table with the following description: +-----------+---------------+------+-----+---------+-------+ | Field | Type | Null…
barras
  • 83
  • 1
  • 1
  • 6
7
votes
1 answer

"#1054 - Unknown column" error when alias is used with-in the query?

While using the following query, I get the error #1054 - Unknown column 'plus' in 'field list' when plus-minus is used. Otherwise, query runs fine. I guess there is something related to Aliases which I do not know how to use. Please…
BufferStack
  • 549
  • 9
  • 20
7
votes
6 answers

#1054 - Unknown column 'id' in 'field list' - phpMyAdmin

I've read my threads about this problem but I still don't know how to solve it. Error SQL query: -- -- Dump data for table `bi_instituicoes` -- INSERT INTO `bi_instituicoes` (`id`, `Instituicao`, `Morada`, `Código Postal`, `Localidade`, `País`)…
user3002293
  • 229
  • 3
  • 4
  • 13
1
2 3
19 20