i want to use join when post_type is 1, i'm using case for join but my sql command is not correct. please help me.
mysql:
SELECT SQL_CALC_FOUND_ROWS
i. * ,
c.title AS category_name,
s.title AS status_title,
i.thumb_image,
CONCAT( u.name, ' ', u.family ) AS author
FROM contents i
CASE WHEN post_type = 1 then
JOIN categories c ON c.id = i.category
end
JOIN users u ON u.id = i.posted_by
JOIN status_topics s ON s.id = i.t_status
WHERE i.id = 2