Select from a table that is not in other table

How can I select values form a Mysql table that are not already stored in other table? Server connect.

Can you give an example? You would likely have to do a Join with the two tables in your server connect query if I understand correctly.

Select where? Sorry, I don’t understand what you are trying to accomplish.

Something like this

SELECT * FROM list_platforms where id NOT IN (SELECT id_platform from hotel_list_platform WHERE id_category = :hotelCategory)

If I understand you correctly, then you can do this with 2 queries, for example, I made this right now for you:

  1. Table 1
    image
  2. Table 2
    image
  3. First query:
    image
  4. Second query:
    image
  5. The condition of the second query:

Which is:
query.join(',', 'user').split(',')
The results are:
image

You can see that the second query doesn’t have user1/user2/user3 because they are on the first query.

1 Like

This is my “go to” guide

Edit: should note, if using SQLite, it does not support right joins! Just reverse the tables and use left

1 Like