0
I have 3 tables
I need a query that takes the name of the school, number of classes type A, Qtde of classes type B, Qtde of students who are in classes type A, and Qtde of students who are in classes type B.
Like this example:
I tried to make
Select E.NOME,
SUM(CASE WHEN C.TIPO = 4 THEN 1 ELSE 0 end) as CLTELE5A8,
SUM(CASE WHEN C.TIPO = 5 THEN 1 ELSE 0 end) as CLTELEMED,
but I don’t know how I’m going to count students
It is a simplification of the original tables.
– Gabriel Heguedusch
Start to make a solution, I am very Arrado. Maybe you can finish: Sqlfiddle
– Marconi
IS
MySQL
same or SQL Server as in your other questions?– Sorack
SQL Server, I put mysql because I didn’t think it would change the solution syntax a lot
– Gabriel Heguedusch