gpt4 book ai didi

mysql - 执行多重选择时,错误子查询返回大于 1

转载 作者:行者123 更新时间:2023-11-29 11:04:39 25 4
gpt4 key购买 nike

我想在一个查询中使用不同的条件进行多项选择。但不知何故我陷入了这个问题。有什么想法吗?

SELECT
(select io_link_event_names.name from doors left join controller_devices on doors.iid = controller_devices.iid left join events on controller_devices.mac = events.mac left join io_link_event_names on events.iolinkerid = io_link_event_names.extra where events.iolinkerid = "9000;1") AS forced,
(select doors.name FROM doors) AS doorname

错误 #1242 - 子查询返回超过 1 行

最佳答案

考虑一下

SELECT d.[forced], doors.name as doorname
from doors
left join (
select controller_devices.iid, io_link_event_names.name as [forced]
from events
inner join controller_devices on controller_devices.mac = events.mac
inner join io_link_event_names on events.iolinkerid = io_link_event_names.extra
where events.iolinkerid = "9000;1"
) as d on d.iid = doors.iid

关于mysql - 执行多重选择时,错误子查询返回大于 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41607749/

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