Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.32 KB | None | 0 0
  1. SELECT
  2.     alun.nome, (SELECT AVG(hist_aux.nota) FROM HISTORICO hist_aux WHERE alun.matricula = hist_aux.matricula) AS Media
  3. FROM
  4.     HISTORICO hist,
  5.     ALUNO alun,
  6.     TURMA turma
  7. WHERE
  8.     alun.matricula = hist.matricula AND
  9.     hist.cod_turma = turma.cod_turma AND
  10.     turma.ano = 2013
  11. ORDER BY Media DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement