运行SQL查询会在SQL语法中返回错误

时间:2014-11-19 07:24:17

标签: php mysql database magento

我尝试输入以下脚本,要求开发人员运行。因此,完成了magento模块的删除。但我一直收到一个返回错误。

MySQL说:

  

1064 - 您的SQL语法出错;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   在第3行'WHERE eav_attribute attribute_code ='tipo_pessoa'附近   ?

我正试图跑..

   

 >DELETE FROM `core_resource` WHERE CODE = 'idecheckoutvm_setup';

>DELETE FROM WHERE `eav_attribute` attribute_code = 'tipo_pessoa'; 
>DELETE FROM WHERE `eav_attribute` attribute_code = 'rg'; 
>DELETE FROM WHERE `eav_attribute` attribute_code = 'razao_social'; 
>DELETE FROM WHERE `eav_attribute` attribute_code = 'nome_fantasia'; 
>DELETE FROM WHERE `eav_attribute` attribute_code = 'insc_est'; 
>DELETE FROM WHERE `eav_attribute` attribute_code = 'mobile';
>
>ALTER TABLE DROP COLUMN `sales_flat_order` customer_tipo_pessoa; 
>ALTER TABLE `sales_flat_quote` customer_tipo_pessoa DROP COLUMN;
>
>ALTER TABLE `sales_flat_order` customer_razao_social DROP COLUMN, 
>ALTER TABLE `sales_flat_quote` customer_razao_social DROP COLUMN;
>
>ALTER TABLE DROP COLUMN `sales_flat_order` customer_nome_fantasia; 
>ALTER TABLE DROP COLUMN `sales_flat_quote` customer_nome_fantasia;
>
>ALTER TABLE DROP COLUMN `sales_flat_order` customer_rg; 
>ALTER TABLE DROP COLUMN `sales_flat_quote` customer_rg;
>
>ALTER TABLE DROP COLUMN `sales_flat_order` customer_insc_est; 
>ALTER TABLE DROP COLUMN `sales_flat_quote` customer_insc_est;
>
>ALTER TABLE DROP COLUMN `sales_flat_order_address` mobile; 
>ALTER TABLE DROP COLUMN `sales_flat_quote_address` mobile;
>
>DELETE FROM `core_config_data` WHERE path LIKE '% idecheckoutvm%';

  

服务器:通过UNIX套接字软件的本地主机:Percona服务器软件   版本:5.5.40-36.1 - Percona Server(GPL),版本36.1,修订版   707协议版本:10

6 个答案:

答案 0 :(得分:3)

DELETE FROM WHERE eav_attribute 

是的,删除但实际上从哪里来?你错过了表名

DELETE FROM `eav_attribute` WHERE  attribute_code = 'tipo_pessoa';
             ^              ^

相同
ALTER TABLE DROP COLUMN     // Alter which table?

除了你的几个问题之外的所有问题都没有。

答案 1 :(得分:0)

是否应该有"。"这些之间?缺少的表名(多个)表示"替换"编辑已经发生?

答案 2 :(得分:0)

更改

  

DELETE FROM WHERE eav_attribute ....

  

从eav_attribute删除WHERE .....

答案 3 :(得分:0)

你的删除语法混乱了。它应该是delete from table where ...而不是delete from where table ...

所以,例如,而不是:

DELETE FROM WHERE eav_attribute attribute_code = 'tipo_pessoa'; 

你应该:

DELETE FROM eav_attribute WHERE attribute_code = 'tipo_pessoa';

其他删除语句也是如此。

答案 4 :(得分:0)

delete语句的正确语法是:

Delete from <table_name> where ....

你的陈述是:

DELETE FROM WHERE eav_attribute attribute_code = 'tipo_pessoa';

&#34; FROM&#34;

后缺少表名

答案 5 :(得分:0)

谢谢你。 RAN THE EDITS和一切RAN SMOOTHLY。 对于那些好奇的人来说,这是最后的改变。

再次感谢。

&#13;
&#13;
DELETE FROM `core_resource` WHERE CODE = 'idecheckoutvm_setup';

DELETE FROM `eav_attribute` WHERE attribute_code = 'tipo_pessoa';
DELETE FROM `eav_attribute` WHERE attribute_code = 'rg';
DELETE FROM `eav_attribute` WHERE attribute_code = 'razao_social';
DELETE FROM `eav_attribute` WHERE attribute_code = 'nome_fantasia';
DELETE FROM `eav_attribute` WHERE attribute_code = 'insc_est';
DELETE FROM `eav_attribute` WHERE attribute_code = 'mobile';

ALTER TABLE `sales_flat_order` DROP COLUMN customer_tipo_pessoa;
ALTER TABLE `sales_flat_quote` DROP COLUMN customer_tipo_pessoa;

ALTER TABLE `sales_flat_order` DROP COLUMN customer_razao_social;
ALTER TABLE `sales_flat_quote` DROP COLUMN customer_razao_social;

ALTER TABLE `sales_flat_order` DROP COLUMN customer_nome_fantasia;
ALTER TABLE `sales_flat_quote` DROP COLUMN customer_nome_fantasia;

ALTER TABLE `sales_flat_order` DROP COLUMN customer_rg;
ALTER TABLE `sales_flat_quote` DROP COLUMN customer_rg;

ALTER TABLE `sales_flat_order` DROP COLUMN customer_insc_est;
ALTER TABLE `sales_flat_quote` DROP COLUMN customer_insc_est;

ALTER TABLE `sales_flat_order_address` DROP COLUMN mobile;
ALTER TABLE `sales_flat_quote_address` DROP COLUMN mobile;

DELETE FROM `core_config_data` WHERE path LIKE '%idecheckoutvm%';
&#13;
&#13;
&#13;