steinsgate Posted January 24, 2013 Share Posted January 24, 2013 (edited) I cannot select condition using a simple and standard query for the field, it works for visibility which is the same type. Server version: 5.1.66-log Source distribution mysql> SELECT condition from ps_product; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition FROM ps_product' at line 1 mysql> SELECT visibility FROM ps_product LIMIT 1; +------------+ | visibility | +------------+ | | +------------+ 1 row in set (0.00 sec) mysql> desc ps_product; +---------------------------+----------------------------------------+------+-----+----------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------------+----------------------------------------+------+-----+----------+----------------+ | id_product | int(10) unsigned | NO | PRI | NULL | auto_increment | | id_supplier | int(10) unsigned | YES | MUL | NULL | | | id_manufacturer | int(10) unsigned | YES | MUL | NULL | | | id_category_default | int(10) unsigned | YES | MUL | NULL | | | id_shop_default | int(10) unsigned | NO | | 1 | | | id_tax_rules_group | int(11) unsigned | NO | | NULL | | | on_sale | tinyint(1) unsigned | NO | | 0 | | | online_only | tinyint(1) unsigned | NO | | 0 | | | ean13 | varchar(13) | YES | | NULL | | | upc | varchar(12) | YES | | NULL | | | ecotax | decimal(17,6) | NO | | 0.000000 | | | quantity | int(10) | NO | | 0 | | | minimal_quantity | int(10) unsigned | NO | | 1 | | | price | decimal(20,6) | NO | | 0.000000 | | | wholesale_price | decimal(20,6) | NO | | 0.000000 | | | unity | varchar(255) | YES | | NULL | | | unit_price_ratio | decimal(20,6) | NO | | 0.000000 | | | additional_shipping_cost | decimal(20,2) | NO | | 0.00 | | | reference | varchar(32) | YES | | NULL | | | supplier_reference | varchar(32) | YES | | NULL | | | location | varchar(64) | YES | | NULL | | | width | decimal(20,6) | NO | | 0.000000 | | | height | decimal(20,6) | NO | | 0.000000 | | | depth | decimal(20,6) | NO | | 0.000000 | | | weight | decimal(20,6) | NO | | 0.000000 | | | out_of_stock | int(10) unsigned | NO | | 2 | | | quantity_discount | tinyint(1) | YES | | 0 | | | customizable | tinyint(2) | NO | | 0 | | | uploadable_files | tinyint(4) | NO | | 0 | | | text_fields | tinyint(4) | NO | | 0 | | | active | tinyint(1) unsigned | NO | | 0 | | | redirect_type | enum('','404','301','302') | NO | | | | | id_product_redirected | int(10) unsigned | NO | | 0 | | | available_for_order | tinyint(1) | NO | | 1 | | | available_date | date | NO | | NULL | | | condition | enum('new','used','refurbished') | NO | | new | | | show_price | tinyint(1) | NO | | 1 | | | indexed | tinyint(1) | NO | MUL | 0 | | | visibility | enum('both','catalog','search','none') | NO | | both | | | cache_is_pack | tinyint(1) | NO | | 0 | | | cache_has_attachments | tinyint(1) | NO | | 0 | | | is_virtual | tinyint(1) | NO | | 0 | | | cache_default_attribute | int(10) unsigned | YES | | NULL | | | date_add | datetime | NO | MUL | NULL | | | date_upd | datetime | NO | | NULL | | | advanced_stock_management | tinyint(1) | NO | | 0 | | +---------------------------+----------------------------------------+------+-----+----------+----------------+ 46 rows in set (0.00 sec) Regards Edited January 24, 2013 by steinsgate (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted March 5, 2016 Share Posted March 5, 2016 Your problem is that condition is a reserved word in MySql. So you should write it between backticks like `condition`. Link to comment Share on other sites More sharing options...
Recommended Posts