我有两张桌子。
这是结构
CREATE TABLE IF NOT EXISTS `CATALOG_CATEGORY_PRODUCT`
(
`CATEGORY_ID` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Category ID',
`PRODUCT_ID` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Product ID',
`POSITION` INT(11) NOT NULL DEFAULT '0' COMMENT 'Position',
PRIMARY KEY (`CATEGORY_ID`, `PRODUCT_ID`),
KEY `IDX_CATALOG_CATEGORY_PRODUCT_PRODUCT_ID` (`PRODUCT_ID`)
)
ENGINE=INNODB
DEFAULT CHARSET=UTF8
COMMENT='Catalog Product To Category Linkage Table';
CREATE TABLE IF NOT EXISTS `CATALOG_PRODUCT_ENTITY_TIER_PRICE`
(
`VALUE_ID` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'Value ID',
`ENTITY_ID` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT
'Entity ID',
`ALL_GROUPS` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1' COMMENT
'Is Applicable To All Customer Groups',
`CUSTOMER_GROUP_ID` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT
'Customer Group ID',
`QTY` DECIMAL(12, 4) NOT NULL DEFAULT '1.0000' COMMENT 'QTY',
`VALUE` DECIMAL(12, 4) NOT NULL DEFAULT '0.0000' COMMENT
'Value',
`WEBSITE_ID` SMALLINT(5) UNSIGNED NOT NULL COMMENT 'Website ID',
PRIMARY KEY (`VALUE_ID`)
)
ENGINE=INNODB
DEFAULT CHARSET=UTF8
COMMENT='Catalog Product Tier Price Attribute Backend Table';
我使用了以下查询
SELECT * FROM `catalog_product_entity_tier_price` LEFT OUTER JOIN catalog_category_product ON catalog_product_entity_tier_price.entity_id = catalog_category_product.product_id WHERE catalog_category_product.category_id = 57 AND catalog_product_entity_tier_price.qty = 500.0000
它返回 97 行。我想删除那 97 行。
所以我使用了这个查询。
DELETE FROM `catalog_product_entity_tier_price` LEFT OUTER JOIN catalog_category_product WHERE catalog_product_entity_tier_price.entity_id = catalog_category_product.product_id AND catalog_category_product.category_id = 57 AND catalog_product_entity_tier_price.qty = 500.0000
但我收到了这个错误。
#1064 - 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 'LEFT OUTER JOIN catalog_category_product WHERE catalog_product_entity_tier_price' at line 1
有人能告诉我正确的语法吗?
谢谢