We’re trying to simply list recent threads from a table that the user in question hasn’t joined in to yet.
The code below does not work (shows both new threads and threads that the user already joined in to), but shows what tables we’re using:
SELECT t.*, jt.*
FROM thread t
INNER JOIN joined_threads jt ON jt.thread_id = t.unique_id
WHERE t.owner != '$user_id'
AND jt.saved_by != '$user_id'
GROUP BY t.unique_id
Used tables:
THREAD:
unique_id
owner
title
content
date
and
JOINED_THREADS:
saved_by
thread_id
I presume this is very easy for most of you 🙂
If I understand what you need
(not tested). Btw what for do you need jt.*, would be always NULL