SQL SERVER ERROR SUBCONSULTA
Publicado por Cristian (2 intervenciones) el 13/06/2016 02:33:09
AYUUUDAAA!!
select U.usurioId ,(Select CP3.chatId from chatParticipante CP3 , chat C3, usuario U3
where C3.esGrupo = 1 and C3.chatId = CP3.chatId and U3.usurioId = U.usurioId
GROUP by CP3.chatId
Having MAX(IDCHAT.CantidadDeParticipantes) = IDCHAT.CantidadDeParticipantes )CHATID
From
(Select C2.chatId, COUNT(CP2.chatId)as CantidadDeParticipantes
from chat C2, chatParticipante CP2
where C2.esGrupo = 1 and C2.chatId = CP2.chatId
Group by C2.chatId)as IDCHAT, usuario as U , chat as C, chatParticipante as CP
where C.esGrupo = 1 and C.chatId = CP.chatId and CP.usuarioParticipante = U.usurioId
Group by U.usurioId, CP.chatId ,IDCHAT.CantidadDeParticipantes
ERROR! ----->>> Msg 512, Level 16, State 1, Line 1
La subconsulta ha devuelto más de un valor, lo que no es correcto cuando va a continuación de =, !=, <, <=, >, >= o cuando se utiliza como
select U.usurioId ,(Select CP3.chatId from chatParticipante CP3 , chat C3, usuario U3
where C3.esGrupo = 1 and C3.chatId = CP3.chatId and U3.usurioId = U.usurioId
GROUP by CP3.chatId
Having MAX(IDCHAT.CantidadDeParticipantes) = IDCHAT.CantidadDeParticipantes )CHATID
From
(Select C2.chatId, COUNT(CP2.chatId)as CantidadDeParticipantes
from chat C2, chatParticipante CP2
where C2.esGrupo = 1 and C2.chatId = CP2.chatId
Group by C2.chatId)as IDCHAT, usuario as U , chat as C, chatParticipante as CP
where C.esGrupo = 1 and C.chatId = CP.chatId and CP.usuarioParticipante = U.usurioId
Group by U.usurioId, CP.chatId ,IDCHAT.CantidadDeParticipantes
ERROR! ----->>> Msg 512, Level 16, State 1, Line 1
La subconsulta ha devuelto más de un valor, lo que no es correcto cuando va a continuación de =, !=, <, <=, >, >= o cuando se utiliza como
Valora esta pregunta


0