I'm trying to develop a Query where, it needs to be queried in 6 equal tables if there is any specific value.
Here's my Query:
SELECT (
CASE WHEN (SELECT * FROM sala1 WHERE aluno = '$AlunoInformado') = 1 THEN END
ELSE
CASE WHEN(SELECT * FROM sala2 WHERE aluno = '$AlunoInformado') = 1 THEN END
ELSE
CASE WHEN(SELECT * FROM sala3 WHERE aluno = '$AlunoInformado') = 1 THEN END
ELSE
CASE WHEN(SELECT * FROM sala4 WHERE aluno = '$AlunoInformado') = 1 THEN END
ELSE
CASE WHEN(SELECT * FROM sala5 WHERE aluno = '$AlunoInformado') = 1 THEN END
ELSE
CASE WHEN(SELECT * FROM sala6 WHERE aluno = '$AlunoInformado') = 1 THEN END
END
END
END
END
END
END
)entrada FROM $SelectSalas WHERE status = 0
NOTE: $AlunoInformado
receives a value that can have on all tables.
But when you query, Operand should contain 10 column (s).
What is wrong with the query? Why does not the column show entrada
according to the statement before FROM
?