I have a table of data which has posts, then I have a separate table of data which has deleted posts. What happens when a post is deleted is that it’s ID get’s added to the deleted table rather than removing the post entry.
What is a clean efficient way of selecting all the posts from the posts table without selecting the ones that have their ID in the deleted table
If you can’t change your tables, you can do a
Left Join(which will join yourdeleted_tablewhen possible) and then check for theidto beNull(means that no row has been found).Make sure to have indexes on both
id-columns for best performance.