Hi
I am now running this query
SELECT p.topic_id, p.topic_id, p.forum_id, p.author_id + @user_id_jump,
p.ip_address, p.topic_date,
(SELECT username FROM members WHERE member_id = p.author_id) AS post_username,
p.title, p.body,
CASE
WHEN (SELECT post_id FROM forum_attachments WHERE post.id = p.post_id) != 0 THEN 1
ELSE 0
END AS post_attachment,
FROM forum_topics p;
but receiving the following syntax error
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM exp_forum_topics p' at line 14
What I am attempting to do is check if post.id exists in forum_attachments and if it does assign a value of 1 to post_attachment otherwise 0.
Would really appreciate some help and perhaps a recommendation of a good book or online tutorial I could refer to for mysql.
Many thanks
Mark