SELECT posts.*,
post_attributes.name AS attribute_names,
post_attributes.value AS attribute_values,
COUNT(comments.id) AS comment_count,
MAX(comments.created_at) AS latest_comment
FROM posts
LEFT JOIN post_attributes ON (post_attributes.post_id = posts.id)
LEFT JOIN comments ON (comments.post_id = posts.id)
AND (comments.status != 'spam')
AND (comments.status != 'denied' OR (
(
comments.user_id != 0 AND
comments.user_id = 0
) OR (
comments.id IN (0)
)
))
WHERE (YEAR(posts.created_at) = 2010)
AND (MONTH(posts.created_at) = 01)
AND (DAY(posts.created_at) = 06)
AND (posts.url = 'new-blog')
AND (posts.feather IN ('text', 'link', 'photo', 'audio', 'chat', 'video', 'quote'))
AND (posts.status IN ('public') OR posts.status LIKE '%{5}%')
GROUP BY posts.id,
post_attributes.name
ORDER BY posts.id DESC
Array
(
[:visitor_id] => 0
[:YEAR_created_at_] => 2010
[:MONTH_created_at_] => 01
[:DAY_created_at_] => 06
[:url] => new-blog
)
#0 /var/www/eatthepath.com/includes/class/SQL.php(201): Query->__construct(Object(SQL), 'SELECT posts.*,...', Array, false)
#1 /var/www/eatthepath.com/includes/class/SQL.php(238): SQL->query('SELECT __posts....', Array, false)
#2 /var/www/eatthepath.com/includes/class/Model.php(163): SQL->select(Array, Array, Array, 'id DESC', Array, NULL, NULL, Array, Array)
#3 /var/www/eatthepath.com/includes/model/Post.php(72): Model::grab(Object(Post), NULL, Array)
#4 /var/www/eatthepath.com/includes/model/Post.php(703): Post->__construct(NULL, Array)
#5 /var/www/eatthepath.com/includes/controller/Main.php(374): Post::from_url(Array, Array)
#6 [internal function]: MainController->view(Array)
#7 /var/www/eatthepath.com/includes/class/Route.php(99): call_user_func_array(Array, Array)
#8 /var/www/eatthepath.com/index.php(22): Route->init()
#9 {main}
Log In →
Chyrp 2.0 RC3 © 2008 Alex Suraci