2011-04-27 59 views
0

將不執行。請讓我知道這個問題..MySQL的:查詢不執行下面的查詢

CREATE TABLE IF NOT EXISTS `catalog_category_entity_varchar` (
    `value_id` int(11) NOT NULL AUTO_INCREMENT, 
    `entity_type_id` smallint(5) unsigned NOT NULL DEFAULT '0', 
    `attribute_id` smallint(5) unsigned NOT NULL DEFAULT '0', 
    `store_id` smallint(5) unsigned NOT NULL DEFAULT '0', 
    `entity_id` int(10) unsigned NOT NULL DEFAULT '0', 
    `value` varchar(255) NOT NULL DEFAULT '', 
    PRIMARY KEY (`value_id`), 
    UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`) USING BTREE, 
    KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`), 
    KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE` (`attribute_id`), 
    KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE` (`store_id`) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1122 ; 

此表屬於Magento的項目..

+0

語法是好的,U有權創建? – 2011-04-27 05:38:37

+0

是的,我有權創建。沒有權限問題.. – Arung 2011-04-27 05:39:47

+0

'#1064 - 你的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,以便在'USING BTREE'附近使用正確的語法, KEY'FK_ATTRIBUTE_VARCHAR_ENTITY'('entity_id'), KEY'FK_CATA'at line 9'這是錯誤顯示當我嘗試在phpmyadmin中執行。 – Arung 2011-04-27 05:40:27

回答

2

在MySQL之前的版本5.1你必須在括號之前使用USING BTREE。 嘗試改變

UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`) USING BTREE 

UNIQUE KEY `IDX_BASE` USING BTREE (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`) 
+0

1000感謝好友..它的工作很棒! – Arung 2011-04-27 05:59:34