陷入MySQL查询(不是唯一的表/别名:'PRICE')错误

时间:2013-03-11 14:55:07

标签: mysql

当运行我的查询时,我得到一个'不是唯一的表/别名:' PRICE''。经过几个小时的尝试,我坚持了下来! (它是一个改变的MS SQL查询)

SELECT
    PRICE_GENERIC.`Part Description` AS post_title,
    `PRICE_GENERIC`.`Part Description` AS post_name,
    PRICE_GENERIC.`Material Long Description` AS post_excerpt,
    "" AS post_content,
    "publish" AS post_status,
    "0" AS menu_order,
    "02/22/2013 17:17" AS post_date,
    "0" AS post_parent,
    "closed" AS comment_status,
    PRICE_GENERIC.`EANUPC Code` AS sku,
    "visible" AS visibility,
    PRICE_GENERIC.`Available Quantity` AS stock,
    "instock" AS stock_status,
    "no" AS backorders,
    "" AS manage_stock,
    PRICE_GENERIC.`Customer Price` AS regular_price,
    "" AS sale_price,
    PRICE.Weight AS weight,
    PRICE.Length AS length,
    PRICE.Width AS width,
    PRICE.Height AS height,
    "taxable" AS tax_status,
    "*" AS tax_class,
    "" AS upsell_ids,
    "" AS crosssell_ids,
    "" AS featured,
    "" AS sale_price_dates_from,
    "" AS sale_price_dates_to,
    'http://' AS file_path,
    "" AS download_limit,
    "" AS external_url,
    "" AS images,
    categories_adj.HOOFDCATEGORIE AS `tax:product_cat`,
    "" AS `tax:product_tag`,
    "simple" AS `tax:product_type`
FROM
    PRICE_GENERIC,
    categories_adj,
    PRICE
INNER JOIN `FEES_GENERIC` ON `PRICE_GENERIC`.`Part Number` = `FEES_GENERIC`.`Part Number`
INNER JOIN `HOURLY_STOCK_GENERIC` ON `PRICE_GENERIC`.`Part Number` = `HOURLY_STOCK_GENERIC`.`Part Number`
INNER JOIN `PRICE` ON `PRICE_GENERIC`.`Part Number` = `PRICE`.`Part Number`
INNER JOIN `CATEGORIES` ON `PRICE`.`Sub-Category` = `CATEGORIES`.`Product Hierarchy Number Level 2`
INNER JOIN `categories_adj` ON `CATEGORIES`.`Product Hierarchy Number Level 2` = `categories_adj`.`Product Hierarchy Number Level 2`
WHERE
    `categories_adj`.`HOOFDCATEGORIE` IS NOT NULL
;

1 个答案:

答案 0 :(得分:0)

你要加入PRICE表两次,在这里:

FROM
    PRICE_GENERIC,
    categories_adj,
    PRICE

在这里:

INNER JOIN `PRICE` ON `PRICE_GENERIC`.`Part Number` = `PRICE`.`Part Number`

如果这确实是你的意图,而不是错误(对我而言),你需要为它们中的最后一个提供一个别名。

同样适用于categories_adj