23 lines
388 B
SQL
23 lines
388 B
SQL
/* Select the data we need to display the on the front page */
|
|
SELECT
|
|
posts.id,
|
|
posts.post_title,
|
|
posts.isanon,
|
|
posts.post_time,
|
|
authors.name,
|
|
posts.views,
|
|
COUNT(comments.id)
|
|
FROM
|
|
posts,
|
|
authors
|
|
LEFT JOIN comments ON comments.postid = posts.id
|
|
WHERE
|
|
posts.authorid = authors.id AND
|
|
posts.unlisted = 0
|
|
GROUP BY
|
|
posts.id
|
|
ORDER BY
|
|
posts.post_time DESC
|
|
LIMIT 50
|
|
OFFSET :offset;
|