I have two queries that work perfectly apart, but I needed all of their records together.
They would be these:
SELECT b.idBanca AS idB, b.DataHora AS dataHora,
b.Sala AS sala, t.idTrabalho AS idT,
p.Nome AS orientador, a.Nome AS aluno, t.Nome AS trabalho
FROM Bancas b
INNER JOIN Trabalhos t ON t.idTrabalho = b.idTrabalho
INNER JOIN Professores p ON t.idProfessor = p.idProfessor
INNER JOIN Alunos a ON t.idAluno = a.idAluno
INNER JOIN ProfessoresBancas pb ON b.idBanca = pb.idBanca
WHERE t.idSemestre = '$idSemestre' AND pb.idProfessor = '$idProfessor'
ORDER BY dataHora
and
SELECT b.idBanca AS idB, b.DataHora AS dataHora,
b.Sala AS sala, t.idTrabalho AS idT,
p.Nome AS orientador, a.Nome AS aluno, t.Nome AS trabalho
FROM Bancas b
INNER JOIN Trabalhos t ON t.idTrabalho = b.idTrabalho
INNER JOIN Professores p ON t.idProfessor = p.idProfessor
INNER JOIN Alunos a ON t.idAluno = a.idAluno
INNER JOIN ProfessoresBancas pb ON b.idBanca = pb.idBanca
WHERE t.idSemestre = '$idSemestre' AND p.idProfessor = '$idProfessor'
ORDER BY dataHora
Only what changes is the $idProfessor
of the WHERE clause ... I need the records of the two within the same array arriving in PHP ... I tried with UNION, with SELECT chained and nothing ... Anyone know an alternative?