Hola movorack, gracias por responder...y por tu ayuda, te comento con tu ayuda hice lo siguiente:
Código SQL
[-]
SELECT i.IdE,(i.NomE+' '+i.ApePE+' '+i.ApeME)AS Nom,i.CarreraE,i.DeptoE,
-- todos los datos que seleccionas
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 2) as Febrero,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 3) as Marzo,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 4) as Abril,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 5) as Mayo,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 6) as Junio,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 7) as Julio,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 8) as Agosto,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 9) as Septiembre,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 10) as Octubre,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 11) as Noviembre,
(select MontoRecibido from BDbeca b2 where b2.IdE = i.IdE and YEAR(b2.Fecha) = YEAR(b1.Fecha) and MONTH(b2.Fecha) = 12) as Diciembre,
sum(b1.MontoRecibido) as TotalRecibido
FROM BDinscripcion i
INNER JOIN BDbeca b1 on i.IdE = b1.IdE
WHERE YEAR(b1.fecha) = '2010'
GROUP BY i.IdE, i.Nom,i.CarreraE,i.DeptoE
-- Los campos de agrupación
Solo que me aparece el siguiente error:
Cita:
Servidor: mensaje 207, nivel 16, estado 3, línea 1
El nombre de columna 'MontoRecibido' no es válido.
|
Este msj me repite varias veces...
Si podrias ayudarme...
Graaacias!
Saludos