06/06/2011, 10:29
|
| | Fecha de Ingreso: abril-2011 Ubicación: España, Mdrid
Mensajes: 89
Antigüedad: 13 años, 6 meses Puntos: 1 | |
Alguien me pude decir si hay errores en este codigo SELECT
`posts`.`post_id` AS `id`,
`posts`.`post_title` AS `title`,
LEFT(`post`.`post_body`, 512) AS `preview`,
`post`.`post_user` AS `user`,
DATE_FORMAT(`post`.`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
He pasado este codigo miles de veces por le depurador de PHPmyAdmin y simepre me sale errores. Me podrías ayudar. |