2023-08-10 00:28:48 +02:00
|
|
|
/*
|
|
|
|
Select the data we need to display the on the front page
|
|
|
|
*/
|
2020-05-17 18:05:00 +02:00
|
|
|
SELECT
|
|
|
|
posts.id,
|
|
|
|
posts.post_title,
|
|
|
|
posts.isanon,
|
|
|
|
posts.post_time,
|
2021-01-04 03:48:29 +01:00
|
|
|
authors.name,
|
2023-03-01 01:41:51 +01:00
|
|
|
posts.views,
|
|
|
|
COUNT(comments.id)
|
2020-05-17 18:05:00 +02:00
|
|
|
FROM
|
|
|
|
posts,
|
|
|
|
authors
|
2023-03-01 01:41:51 +01:00
|
|
|
LEFT JOIN comments ON comments.postid = posts.id
|
2020-05-17 18:05:00 +02:00
|
|
|
WHERE
|
2021-01-10 22:34:13 +01:00
|
|
|
posts.authorid = authors.id AND
|
|
|
|
posts.unlisted = 0
|
2023-03-01 01:41:51 +01:00
|
|
|
GROUP BY
|
|
|
|
posts.id
|
2020-05-17 18:05:00 +02:00
|
|
|
ORDER BY
|
|
|
|
posts.post_time DESC
|
2023-03-01 01:41:51 +01:00
|
|
|
LIMIT 50
|
|
|
|
OFFSET :offset;
|