I have two tables and a linked table between them, One of the users and one of the holidays and the likes link table, I try to come up with all the holidays that a certain user doesn't like I got the same vacation twice because two other people liked her. Is there a way in NSQL to bring me only one of these.
These are users
id u_name 1 Gabi Ashkenazi 2 Johnny Tribiani 3 Bernie Stinson 4 Goku son 5 Bo Bennett
These are holidays
id v_name 1 Venice 2 Rome 3 Maldives 4 Tokyo 5 Israel 6 Berlin 7 Prague 8 never Land
The link table is as follows
id u_id v_id 5 2 7 3 1 6 4 2 5 9 4 4
P粉0601123962024-02-18 17:25:53
Is something like this useful to you? Find all the holidays Johnny likes and return a list of the ones 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 );