I am trying to do a php sql query where I get objects whose user_id aren’t in another database table. Here’s my query now:
SELECT * FROM table1 WHERE user_id='$show_id' ORDER BY id DESC LIMIT 0, 10
Inside it, I check if it’s in my other table. It will only echo if it does not exist in the table. The problem is, is that it won’t display it’s full 10 in the limit.
So my thoughts would be to create one sql query that counts to see if it exists in the other database table.
In my past I have only done simple sql queries (as shown above) and not many multi-table ones as well as putting a query inside a query. Please help!
You can use the
NOT EXISTSoperator: