because my code duplicates mysql records?

-2

I have a problem when I make this query in mysql

select count(carne) TOTAL_ESTUDIANTES, profesor.nombre PROFESOR, cursos.asignatura CURSO
from profesor, cursos, matricula;

I only have 4 students but when I do the consultation, everything is doubled

also in the teacher column should appear the other names of the teachers but only one comes out as in the course column

These are the data of each one

and this is the model

    
asked by Pancho villa 03.05.2018 в 22:33
source

1 answer

0

So that does not happen to you, use the BUT ALSO SOMETHING ON YOUR BASE IS EVIL

select DISTINCT count(carne) TOTAL_ESTUDIANTES, profesor.nombre PROFESOR, cursos.asignatura CURSO
from profesor, cursos, matricula;
    
answered by 04.05.2018 в 00:42