gpt4 book ai didi

mysql - 选择大小写不工作 #1064

转载 作者:太空宇宙 更新时间:2023-11-03 12:32:27 25 4
gpt4 key购买 nike

我有一个问题

SELECT
CASE WHEN QuantityPart =< Threshold
THEN (Threshold - QuantityPart) + Threshold
END as RecommendedReorderQuantity, *
FROM parts, stock

谁能帮忙?

SELECT *, 
CASE WHEN QuantityPart =< Threshold
THEN (Threshold - QuantityPart) + Threshold
END as RecommendedReorderQuantity
FROM parts INNER JOIN stock
ON parts.PartID = stock.PartID

最佳答案

*应该先于你的 CASE satement,还有一件事,应该是

<= =<

SELECT *, 
CASE WHEN QuantityPart <= Threshold
THEN (Threshold - QuantityPart) + Threshold
END as RecommendedReorderQuantity
FROM parts, stock

作为旁注,查询生成笛卡尔积。如果这不是您想要的,那么您需要提供链接条件,例如

SELECT *, 
CASE WHEN QuantityPart <= Threshold
THEN (Threshold - QuantityPart) + Threshold
END as RecommendedReorderQuantity
FROM parts INNER JOIN stock
ON parts.columnName = stock.columnName

哪里columnName是定义它们关系的列。

关于mysql - 选择大小写不工作 #1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14764077/

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