Query mysql with special condition

0

I'm having trouble putting together a query with two tables.

In my bd I have two tables called disciplines and bulletin, in disciplines have the data of each discipline and in bulletin has the foreign keys referring the student and the discipline and a field with the student's note for that discipline. >

I want to put together a query with the join of the two tables that returns all the disciplines and also the notes for each one, but even if it does not have any record in the bulletin table for the discipline.

I tried to do as below, but this way only shows the courses that have a record in the bulletin table, and I want even if I do not have the record to appear the courses with the empty note attribute.

SELECT d.id, d.nome, d.periodo, d.curso, d.ordem, b.nota d FROM disciplinas d LEFT JOIN boletim b ON (d.id = b.disciplina) WHERE (d.curso = :curso AND b.aluno = :aluno) ORDER BY d.ordem, d.id ASC

Can anyone help me with this?

    
asked by anonymous 19.02.2018 / 00:04

0 answers