Tema: Consulta SQL
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/09/2008, 04:57
Avatar de Andres95
Andres95
Colaborador
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 19 años, 5 meses
Puntos: 38
Respuesta: Consulta SQL

Código:
SELECT  Instituto.nombre
       ,COUNT(*)
       ,sum (Case Genero When 'M' Then 1 Else 0 End) [Genero_Masculino]
       ,sum (Case Genero When 'F' Then 1 Else 0 End) [Genero_Femenino]
FROM  Instituto
Inner join
      Alumno
On   Alumno.id_instituto = Instituto.id
GROUP BY Instituto.nombre
Saludos!
__________________
La sencillez y naturalidad son el supremo y último fin de la cultura...
--
MCTS : SQL Server 2008, .NET Framework 3.5, ASP.NET Applications.