Jump to content
nmoa

[Resolvido] valores diferente base de dados

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
tiago.f

Oi,

a logica é:

select QQ onde o ID not está em (select ID from OUTRA_COISA)

Portanto:

select * from submenus where id_submenus not in (select id_submenus from conteudos)

Edited by tiago.f

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.