gpt4 book ai didi

MySQL错误1064但不是保留字

转载 作者:行者123 更新时间:2023-11-30 01:21:23 24 4
gpt4 key购买 nike

我有以下 MySQL 查询

    SELECT REPLACE(book.title,'','') AS "item-name", REPLACE(inventory.sku,'','') AS "sku", REPLACE(IF(inventory.sku IN (SELECT sku FROM qty_skus) , (SELECT qty_skus.quantity FROM qty_skus WHERE qty_skus.sku = inventory.sku LIMIT 1), inventory.quantity),'','') AS "quantity",
REPLACE(LEFT( CONCAT(IF(book_type.book_text IS NOT NULL, CONCAT(book_type.book_text," "), ""), IFNULL(defect.defect,""), " ", IFNULL(inventory.additional_note,""), " ", IFNULL(feature.feature, ""), " ", IFNULL(water.feature, ""), " ", IFNULL(note.note,""),
" " ), 2000),'','') AS "item-note",
REPLACE(IF(book.weight>3.99, "1", "2"),'','') AS "will-ship-internationally", REPLACE(inventory.isbn13,'','') AS "product-id", REPLACE(inventory.ourPrice,'','') AS "price",
REPLACE(IF(book.weight>4.8 AND (inventory.ourPrice - inventory.cost) < 9, "n", "y"),'','') AS "expedited-shipping", REPLACE(book_condition.book_condition,'','') AS "item-condition",
REPLACE(concat(location.location,IF(inventory.fixed="1", " Fixed", "")),'','') AS "Location", REPLACE(book.author,'','') AS "author", REPLACE(book.publisher,'','') AS "publisher",
REPLACE(IF(book_condition.book_condition="New", "11", IF(book_condition.book_condition="Fine", "1", IF(book_condition.book_condition="Very Good", "2", IF(book_condition.book_condition="Good", "3", IF(book_condition.book_condition="Poor", "4", ""))))),'','') AS "condition-id",
REPLACE(IF(inventory.cost < ((follette_title.usedbuying_price *1.37) OR (amtext.price*1.37) OR (nebraska.price *1.2) OR (tichenor.price *1.25)),IF(feature.book_type_3 = "DMG",inventory.cost,
IF(book_condition.book_condition="Good",inventory.cost,
IF(book_condition.book_condition="Poor",inventory.cost,IF(inventory.book_type_id = 3, inventory.cost,
IF(inventory.commission_level = 1, IF(inventory.cost < ((follette_title.usedbuying_price *1.71) OR (amtext.price*1.71)),(max((follette_title.usedbuying_price*1.71) OR (amtext.price*1.71)),inventory.cost),
(max((follette_title.usedbuying_price*1.37) OR (amtext.price*1.37) OR (nebraska.price *1.2) OR (tichenor.price *1.25))))))))),inventory.cost),'','') AS "Cost",
REPLACE(concat(IFNULL(buyer_type.buyer_type, ""),IFNULL(source.source, ""),IFNULL(inventory.source_date, ""),IFNULL(note.book_type_2, ""),IF(inventory.csmt=1, "CSMT", ""),IF(inventory.cu=1, "CU", ""),IF(inventory.manual=1, "manual", ""),IFNULL(book_type.book_code, ""),IF(water.book_type_4="WATER", "WATER", "")),'','') AS "Source", REPLACE(book.pub_date,'','') AS "pubdate", REPLACE(book.binding,'','') AS "Media", REPLACE(book_condition.book_condition,'','') AS "condition",
REPLACE(IF(location.location="FBA", "AMAZON_NA", ""),'','') AS "fulfillment-center-id"
FROM inventory
LEFT JOIN defect ON inventory.defect_id = defect.defect_id
LEFT JOIN book_condition ON defect.condition_id = book_condition.condition_id
LEFT JOIN book_type ON inventory.book_type_id = book_type.book_type_id
LEFT JOIN book ON inventory.isbn13 = book.isbn13
LEFT JOIN feature ON inventory.feature_id = feature.feature_id
LEFT JOIN water on inventory.additional_feature = water.feature_id
LEFT JOIN note ON inventory.note_id = note.note_id
LEFT JOIN location ON inventory.location_id = location.location_id
LEFT JOIN source ON inventory.source_id = source.source_id
LEFT JOIN buyer_type ON source.buyer_type_id = buyer_type.buyer_type_id
LEFT JOIN follette_title on inventory.isbn13 = follette_title.isbn13
LEFT JOIN amtext on inventory.isbn13 = amtext.isbn13
LEFT JOIN nebraska on inventory.isbn13 = nebraska.isbn13
LEFT JOIN tichenor on inventory.isbn13 = tichenor.isbn13
WHERE inventory.upload = 1 AND inventory.ourPrice > 0 AND inventory.location_id > 0 limit 0,20

我收到以下错误,但我不知道原因:

    [Err] 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 '))))),inventory.cost),'','') AS "Cost",                     REPLACE(concat(IFNULL(buyer_type.' at line 12

我查看了错误指示的保留字,但我没有将成本视为保留字。救命!!!

最佳答案

改变这个

    IF(inventory.commission_level = 1, IF(inventory.cost < ((follette_title.usedbuying_price *1.71) OR (amtext.price*1.71)),(max((follette_title.usedbuying_price*1.71) OR (amtext.price*1.71)),inventory.cost),
(max((follette_title.usedbuying_price*1.37) OR (amtext.price*1.37) OR (nebraska.price *1.2) OR (tichenor.price *1.25))))))))),inventory.cost),'','') AS "Cost",

    IF(inventory.commission_level = 1, IF(inventory.cost < ((follette_title.usedbuying_price *1.71) OR  (amtext.price*1.71)),(max((follette_title.usedbuying_price*1.71) OR (amtext.price*1.71)),inventory.cost),
(greatest((follette_title.usedbuying_price*1.37) ,(amtext.price*1.37) , (nebraska.price *1.2), (tichenor.price *1.25))))))))),inventory.cost),'','') AS "Cost",

你不能使用max(a或b或c)而是使用greatest(a,b,c)

关于MySQL错误1064但不是保留字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18492139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com