Raphael Gomes Posted October 5, 2023 Topic Count: 11 Topics Per Day: 0.01 Content Count: 40 Content Per Day: 0.05 Reputation: 4 Achievement Points: 276 Solved Content: 0 Days Won: 0 Status: Offline Device: Windows Report Posted October 5, 2023 Boa tarde, Estou desenvolvendo uma fórmula que retorne o nome do primeiro solicitante do movimento 1.1.01 sendo que aparece a seguinte mensagem abaixo: Mensagem 512, Nível 16, Estado 1, Linha 1 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Tem algo que eu possa fazer na SQL abaixo: SELECT (SELECT (SELECT gusuario.nome FROM gusuario (NOLOCK) WHERE gusuario.codusuario = (SELECT CASE WHEN t.usuariocriacao = 'integracao' THEN tmovcompl.usuariocriacao ELSE t.usuariocriacao END usuario FROM tmov t (NOLOCK) LEFT JOIN tmovcompl (NOLOCK) ON t.codcoligada = tmovcompl.codcoligada AND t.idmov = tmovcompl.idmov WHERE t.idmov = tmov2.idmov)) AS oc FROM tmov tmov1 LEFT JOIN tmovrelac (NOLOCK) ON tmov1.codcoligada = tmovrelac.codcoldestino AND tmov1.idmov = tmovrelac.idmovdestino JOIN tmov tmov2 (NOLOCK) ON tmovrelac.codcolorigem = tmov2.codcoligada AND tmovrelac.idmovorigem = tmov2.idmov WHERE tmovrelac.idmovdestino = tmov.idmov) NOME FROM flan (NOLOCK) LEFT JOIN tmov ON flan.codcoligada = tmov.codcoligada AND flan.idmov = tmov.idmov WHERE flan.datacriacao = '20231005' and flan.codcoligada = 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.