I would like for the query to find distinct posts and replies where tablename.username = '$username'.
This is my current code:
Code: Select all
SELECT DISTINCT
canterbury_posts_out.post_id, canterbury_posts_out.username,
canterbury_posts_out.category, canterbury_posts_out.subject,
canterbury_posts_out.reply_time
FROM canterbury_posts_out, canterbury_replies_out
WHERE canterbury_posts_out.post_id = canterbury_replies_out.post_id
AND canterbury_posts_out.username = '$username'
OR canterbury_replies_out.username = '$username'
AND canterbury_posts_out.post_id = canterbury_replies_out.post_id
ORDER BY canterbury_posts_out.reply_time DESCCode: Select all
AND canterbury_posts_out.post_id = canterbury_replies_out.post_id