I have this sentence.
select nombrem,idparcial,calificacion from calificacion
inner join parcial on parcial.idparcial=calificacion.fkparcial
inner join materia on materia.idmateria=calificacion.fkmateria;
and it gives me this result.
nombrem|idparcial|calificacion|
ingles | 1 | 10
ingles | 2 | 10
ingles | 3 | 10
POO | 1 | 7
POO | 2 | 7
POO | 3 | 7
What I want is that they are grouped by matter more or less something like that
nombrem|idparcial|calificacion|idparcial|calificacion|idparcial|calificacion|
ingles | 1 | 10 | 2 | 10 | 3 | 10
POO | 1 | 10 | 2 | 10 | 3 | 10
I try to put group by and with a multiple inner join but it does not fit me in any way.
create table cuatrimestre(
idcuatri int not null auto_increment,
primary key (idcuatri));
create table materia (
idmateria int not null auto_increment,
nombrem varchar(150) not null,
fkcuatri int not null,
primary key (idmateria),
foreign key (fkcuatri) references cuatrimestre (idcuatri));
create table parcial(
idparcial int not null auto_increment,
primary key (idparcial));
create table calificacion (
idcalificacion int not null auto_increment,
calificacion double not null,
fkparcial int not null,
fkmateria int not null,
primary key (idcalificacion),
foreign key (fkparcial) references parcial(idparcial),
foreign key (fkmateria) references materia (idmateria));
This is my database, will it be that I have poorly structured? and in this case, how would the database be correctly related Thank you in advance.