1
I have two tables, videos
and exercicios
, where I would like the data that is in the two not to be listed, that is, if the foreign key is in the other table, the data should not be shown in the query to avoid being inserted again.
The tables:
videos(
id_video,
titulo_video,
src_video,
descricao_exercicio,
id_professor_video,
id_categoria_video,
data_upload
)
exercicios(
id_exercicio,
id_treino_exercicio,
id_aluno_exercicio,
dia_exercicio
)
I tried to do like the query down but it didn’t work, he keeps showing the videos
who have already been registered:
SELECT
exercicios.*,
videos.*
FROM (
exercicios INNER JOIN videos
ON exercicios.id_treino_exercicio = videos.id_video
)
WHERE
id_professor_video = 1
AND id_categoria_video = 1
AND dia_exercicio != 1
Take a look at Outer Join, solve your problem?
– Thyago Dias
or <not exists>
– Motta
Without knowing the structure of your tables, the data that is in it and an example of desired result based on these data is impossible to help you.
– Sorack