Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
ID repeats how do i reduce

I have two tables and a linking table between them, One of users and one of vacations and a linking table of likes, I try to bring up all the vacations that a certain user did not like And I get the same vacation twice because two other people liked her. Is there a way NSQL will bring me just one of them.

These are the users

id  u_name

1   Gabi    Ashkenazi   
2   Johnny  Tribiani    
3   Bernie  Stinson 
4   Goku    son 
5   Bo  Bennett 

These are the vacations

id  v_name

1   Venice
2   Rome
3   Maldives
4   Tokyo
5   Israel
6   Berlin
7   Prague
8   never Land

And the linking table looks like this


id  u_id   v_id
5   2       7
3   1       6
4   2       5
9   4       4

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Would something like this work for you? Find all the vacations that Johnny likes and then return the list that he doesn't like:

SELECT * 
FROM Vacations 
WHERE v_name not IN 
(
  SELECT v_name 
  FROM Users 
  JOIN Linking 
  ON Users.ID = Linking.U_id 
  JOIN Vacations On Linking.v_id = Vacations.ID
  WHERE Users.ID = 2
);
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda