gpt4 book ai didi

mysql - 连接另一张表,但没有连接限制为一个

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

SELECT op.id,op.nome,op.cognome,op.ore_giornaliere,
(select tp.* from turni_preconf as tp where tp.tot_ore = op.ore_giornaliere limit 5,1)
FROM operatori as op

返回错误:

1241 - 操作数应包含 1 列

我需要选择另一个没有连接的表

谢谢

最佳答案

当用作列表达式时,子查询只能返回一列和一行(即一个值)。如果子查询中需要表中的多于一列,则将需要多个子查询。例如:

SELECT t1.a, t1.b
(SELECT TOP 1 t2.a FROM t2 WHERE something = true) as c,
(SELECT TOP 1 t2.b FROM t2 WHERE something = true) as d
FROM t1

这里有一些关于子查询的好读物:Subquery Fundamentals

关于mysql - 连接另一张表,但没有连接限制为一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23894620/

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