我无法创建视图。您可以在下面找到我的代码。有人可以帮助我吗?
CREATE VIEW V_Campeonato AS SELECT team.tim_cod_inscri_time
, SUM( CASE WHEN partida.par_gol_mand > partida.par_gol_visi THEN 1 ELSE 0 END ) AS VITORIAS
, SUM( CASE WHEN partida.par_gol_mand = partida.par_gol_visi THEN 1 ELSE 0 END ) AS EMPATES
, SUM( CASE WHEN partida.par_gol_mand < partida.par_gol_visi THEN 1 ELSE 0 END ) AS DERROTAS
FROM team
INNER JOIN partida
ON team.tim_cod_inscri_time = partida.par_cod_partida
ORDER BY ( VITORIAS * 3 + EMPATES ) DESC;
ERROR 1247 (42S22): Reference 'VITORIAS' not supported (reference to group function)