sách gpt4 ai đã đi

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

In lại 作者:行者123 更新时间:2023-11-30 22:42:02 32 4
mua khóa gpt4 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 (最终我将生成的每个行用作下拉菜单的动态数据)。

1 Câu trả lời

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

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

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

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

32 4 0
Bài viết được đề xuất: php - 纯 SQL 与 PHP While 循环更快地执行更新
Bài viết được đề xuất: c# - SQL 查询错误
Bài viết được đề xuất: PHP 注册脚本不工作
Bài viết được đề xuất: php - 查询未执行
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com