Jump to content
nmoa

[Resolvido] aparecer registos não preenchidos

Recommended Posts

nmoa

boas

tenho aqui uma questão

tenho duas tabelas

uma de submenus e outra de conteúdos

o que queria fazer era através de um select (já feito) ele me mostrasse apenas os submenus que não estavam inseridos na tabela conteúdos

o meu codigo sql está assim

SELECT * , sub.nome_PT AS nome, sub.id_submenus AS submenu
FROM submenus AS sub
INNER JOIN conteudos AS cnt ON cnt.id_submenus != sub.id_submenus
AND sub.id_template =1
GROUP BY submenu

o que ele me retorna são os valores iguais.....e eu quero é o contrário

obrigado

Share this post


Link to post
Share on other sites
PaisNeto

Bom dia,

verifica se assim dá o que tu queres

SELECT * , sub.nome_PT AS nome, sub.id_submenus AS submenu
FROM submenus AS sub
where sub.id_submenus not in (select cnt.id_submenus from conteudos AS cnt)
AND sub.id_template =1
GROUP BY submenu

Edited by PaisNeto

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.