0
I want to calculate the column Rounds automatically, to get the last 10 games of the team understood? do not manage to do this with SELECT, I think it has to be in the creation of the table...
This is the table creation code and select:
create table Sweden (
TimeID varchar(40) not null,
Rodada int,
Mando varchar(7) not null,
Feitos int not null,
Sofridos int not null,
Feitos1T int not null,
Sofridos1T int not null,
Feitos2T int as (Feitos - Feitos1T),
Sofridos2T int as (Sofridos - Sofridos1T),
Total int as(Feitos + Sofridos),
DadoInserridoEm date
);
select
TimeID as 'Time',
sum(if(Rodada > 0,1,0)) as 'Rodadas',
round(avg(Feitos1T),2) as 'Feitos 1st' ,
round(avg(Sofridos1T),2) as 'Sofridos 1st',
round(avg(Feitos2T),2) as 'Feitos 2nd' ,
round(avg(Sofridos2T),2) as 'Sofridos 2nd',
round(avg(Feitos),2) as 'Feitos' ,
round(avg(Sofridos),2) as 'Sofridos',
round(avg(Feitos1T) + avg(Sofridos1T),2) as 'Media 1st' ,
round(avg(Feitos2T) + avg(Sofridos2T),2) as 'Media 2nd' ,
round(avg(Total),2) as 'Total',
SUM(if(FT80min > 0,1,0)) as 'ft80min',
SUM(if(Total >= 9,1,0)) as 'Over 9 asi',
SUM(if(Total >= 10,1,0)) as 'Over 10 asi',
SUM(if(Feitos > Sofridos,1,0)) as '1x2', -- Teve mais cantos que o adversárioo
max(DadoInserridoEm) as 'Inserido Em'
from Sweden
group by TimeID;
(I’m a beginner)
This way I’ll take the last 10 team, it would work if each team had its own table... I think that was my mistake, put the teams on a single table. Vlw ae
– Obruxo