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 (posts.created_at LIKE '2010-11%')
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.pinned DESC,
posts.created_at DESC,
posts.id DESC
Array
(
[:visitor_id] => 0
[:created_at] => 2010-11%
)
#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(269): SQL->select(Array, Array, Array, 'pinned DESC, cr...', Array, NULL, NULL, Array, Array)
#3 /var/www/eatthepath.com/includes/model/Post.php(142): Model::search('Post', Array, Array)
#4 /var/www/eatthepath.com/includes/controller/Main.php(285): Post::find(Array)
#5 [internal function]: MainController->archive()
#6 /var/www/eatthepath.com/includes/class/Route.php(99): call_user_func_array(Array, Array)
#7 /var/www/eatthepath.com/index.php(22): Route->init()
#8 {main}
Log In →
Chyrp 2.0 RC3 © 2008 Alex Suraci