gpt4 book ai didi

查看 Mysql 错误但在正常查询中工作

转载 作者:行者123 更新时间:2023-11-30 22:42:02 30 4
gpt4 key购买 nike

当我尝试为其创建 View 时出现错误:“ View 的 SELECT 在 FROM 子句中包含一个子查询”,但它在普通查询中工作正常。我认为它与我的 WHERE 子句有关,但我不明白为什么或如何修复它。这是我想要的查询:

select concat(`company`, ' | ', `material`, ' | ', `newcost`) as datarow from( Select `b`.`company` AS `company`, `bp`.`material` AS `material`, if(((`bp`.`cost` * 1.2) < `ls`.`maximumbid`), (`bp`.`cost` * 1.2),`bp`.`cost`) AS `newcost` from (((`windows_brands_products` `bp` left join `windows_brands` `b` on((`bp`.`brand_id` = `b`.`id`))) join `Windows_last_submissions` `ls`) join `windows_materials` `wm`) where ((`bp`.`width` = round(`ls`.`width`,0)) and (`bp`.`height` = round(`ls`.`height`,0)) and (`bp`.`material` = `wm`.`name`) and (`bp`.`type` = `ls`.`type`) and if((`ls`.`minimumbid` <> '0.00'),(`bp`.`cost` between `ls`.`minimumbid` and `ls`.`maximumbid`),(`bp`.`cost` <= `ls`.`maximumbid`))) ) x

为什么会显示此错误以及如何更改它以便我可以将其用作 View (最终我将生成的每个行用作下拉菜单的动态数据)。

最佳答案

Ya 在某种程度上 McAdam331 很可能会有所帮助,但一位 friend 帮助我解决了这个问题。我只是保留了我之前对上述查询的看法,没有使用 concat 内容(从而摆脱了别名)并制作了另一个查看并查询:

select concat(`company`, ' | ', `material`, ' | ', `newcost`) as options
from Windows_last_options

因此引用了“非串联” View 并起作用了!

关于查看 Mysql 错误但在正常查询中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30851083/

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