Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!