Topic: SQL - Select
Hello,
I got the SQL error "#1064 - You have an error in your SQL syntax near 'SELECT id FROM pun_posts WHERE topic_id = 1) AND t.moved_to IS NULL AND f.id" for the following statement.
SELECT t.id, t.poster, t.subject, t.num_replies, p.message, p.posted, p.id
FROM pun_topics AS t
INNER JOIN pun_forums AS f ON f.id = t.forum_id
INNER JOIN pun_posts AS p ON p.topic_id = t.id
LEFT JOIN pun_forum_perms AS fp ON ( fp.forum_id = f.id
AND fp.group_id =3 )
WHERE (
fp.read_forum IS NULL
OR fp.read_forum =1
)
AND p.id
IN (
SELECT id
FROM pun_posts
WHERE topic_id =1
)
AND t.moved_to IS NULL
AND f.id
IN ( 1 )
ORDER BY t.last_post DESC
LIMIT 15
Any ideas? Please advice.
Regards,
gchoyy