1

如下运行我的查询时,我得到一个'非唯一表/别名:'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
;
4

1 回答 1

0

您在PRICE这里加入了两次表:

FROM
    PRICE_GENERIC,
    categories_adj,
    PRICE

和这里:

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

如果这确实是您的意图,而不是错误(在我看来是这样),您需要为其中的最后一个提供别名。

categories_adj桌子也一样

于 2013-03-11T15:00:01.380 回答