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
给我一个错误:
我需要选择一个没有连接的其他表
谢谢
答案 0 :(得分:0)
当用作列表达式时,子查询只能返回一列和一行(即一个值)。如果子查询中的表中需要多个列,则需要多个子查询。 E.g:
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