I am following the tutorial about creating a blog and I am on part 3. I tested my SQL code in phpmyadmin just as you show in the video but it gave me this 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 '. 'post_id' AS 'id', 'posts' . 'post_title' AS 'title', LEFT('post' at line 2
And here is my code:
SELECT
'posts' . 'post_id' AS 'id',
'posts' . 'post_title' AS 'title',
LEFT('posts' . 'post_body', 128) AS 'preview',
DATE_FORMAT('posts' . 'post_date', '%d/%m/%Y %H:%i:%s') AS 'date',
'comments' . 'total_comments',
DATE_FORMAT('comments' . 'last_comment', '%d/%m/%Y %H:%i:%s') AS 'last_comment'
FROM 'posts'
LEFT JOIN (
SELECT
'post_id',
COUNT('comment_id') AS 'total_comments',
MAX('comment_date') AS 'last_comment'
FROM 'comments'
GROUP BY 'post_id'
) AS 'comments'
ON 'posts' . 'post_id' = 'comments' . 'post_id'
ORDER BY 'posts' . 'post_date' DESC