Please help me check my query because it is giving an error that I can not identify. If I do the simple query:
SELECT
*
FROM
respostas
WHERE
resp_usuario='8'
AND resp_questionario='6'
Returns the results normally, but if I insert a join it does not return anything, it follows the Join query:
SELECT
q.quest_nome AS QUESTIONARIO,
u.usu_id AS ID_USUARIO,
u.usu_nome AS USUARIO,
l.loja_id AS END,
a.area_desc AS SETOR,
sb.sub_area_nome AS SUBAREA,
p.perg_desc AS PERGUNTA,
r.resp_resposta AS RESPOSTA,
p.perg_peso AS PESO,
(p.perg_peso * r.resp_resposta) AS PONDERADA,
(p.perg_peso * 5) AS MAXIMO,
(p.perg_peso * r.resp_resposta / (p.perg_peso * 5)*100)PERCENTUAL
FROM
respostas AS r
INNER JOIN questionario AS q ON r.resp_questionario = q.quest_id
INNER JOIN usuarios AS u ON r.resp_usuario = u.usu_id
INNER JOIN lojas AS l ON r.resp_loja = l.loja_id
INNER JOIN area AS a ON r.resp_area = a.area_id
INNER JOIN sub_area AS sb ON r.resp_subgrupo = sb.sub_area_cod
INNER JOIN perguntas AS p ON r.resp_pergunta_id = p.perg_id
WHERE
r.resp_usuario='8'
AND r.resp_questionario='6'
What could I be doing wrong?
Att,