I'm following your blog tutorial series currently on video 3 where you say to check the code in the SQL query from video 2. Well I did that and get this error:
SQL query: Documentation
SELECT `posts`.`post_id` AS `id` , `posts`.`post_title` AS `title` , LEFT( `posts`.`post_body` , 512 ) AS `preview` , `posts`.`post_user` AS `user` , DATE_FORMAT( `posts`.`post_date` , '%d/%m/%Y %H:%i:%s' ) AS `date` ;
MySQL said: Documentation
#1109 - Unknown table 'posts' in field list
Here is my sql:
[syntax=sql]"SELECT
`posts`.`post_id` AS `id`,
`posts`.`post_title` AS `title`,
LEFT(`posts`.`post_body`, 512) AS `preview`,
`posts`.`post_user` AS `user`,
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_comments`
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
"[/syntax]
MY DB is set-up just like in the video DB called blog with two tables one called comments and one called posts