Bug #61534 error 1054 select statement
Submitted: 16 Jun 2011 11:20 Modified: 17 Jun 2011 6:11
Reporter: Mohan T Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:5.2.33 OS:Linux
Assigned to: CPU Architecture:Any
Tags: MySQL, SELECT

[16 Jun 2011 11:20] Mohan T
Description:

i am getting this error for this particular table only, where as other tables works fine,

mysql> desc pur_purchase_goods_receipt_line_item ;
+------------------------------------+-------------+------+-----+---------+----------------+
| Field                              | Type        | Null | Key | Default | Extra          |
+------------------------------------+-------------+------+-----+---------+----------------+
|  id                                | bigint(20)  | NO   | PRI | NULL    | auto_increment |
| item_name                          | varchar(45) | YES  |     | NULL    |                |
| location                           | varchar(45) | YES  |     | NULL    |                |
| exp_date                           | date        | YES  |     | NULL    |                |
| quantity                           | int(11)     | YES  |     | NULL    |                |
| cost_per_unit                      | double      | YES  |     | NULL    |                |
| pur_purchase_goods_receipt_note_id | bigint(20)  | YES  | MUL | NULL    |                |
+------------------------------------+-------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)

mysql> select * from pur_purchase_goods_receipt_line_item ;
+------+-----------+----------+------------+----------+---------------+------------------------------------+
|  id  | item_name | location | exp_date   | quantity | cost_per_unit | pur_purchase_goods_receipt_note_id |
+------+-----------+----------+------------+----------+---------------+------------------------------------+
| 1001 | TV        | Chennai  | 0000-00-00 |        2 |         15000 |                               1001 |
| 1002 | Laptop    | Chennai  | 0000-00-00 |        2 |         31000 |                               1001 |
+------+-----------+----------+------------+----------+---------------+------------------------------------+
2 rows in set (0.00 sec)

mysql> select id from pur_purchase_goods_receipt_line_item ;
ERROR 1054 (42S22): Unknown column 'id' in 'field list'
mysql> show errors;
+-------+------+-------------------------------------+
| Level | Code | Message                             |
+-------+------+-------------------------------------+
| Error | 1054 | Unknown column 'id' in 'field list' |
+-------+------+-------------------------------------+
1 row in set (0.00 sec)

mysql> 

How to repeat:

to repeat use the below query,

mysql> select id from pur_purchase_goods_receipt_line_item ;

ERROR 1054 (42S22): Unknown column 'id' in 'field list'
[16 Jun 2011 12:27] Valeriy Kravchuk
What exact server version, x.y.z, do you use?

Please, send also the results of:

show create table pur_purchase_goods_receipt_line_item\G

from mysql command line client.
[17 Jun 2011 6:11] Mohan T
mysql> show create table pur_purchase_goods_receipt_line_item\g
ERROR 1100 (HY000): Table 'pur_purchase_goods_receipt_line_item' was not locked with LOCK TABLES

thanks for ur reply Mr.Valeriy Kravchuk 

the problem is solved, the table was not locked,

the problem is with the field id, when you see the desc of table closely id has a space before it, it took me some time to get this.,

any way thanks for ur reply man.,