Skip to content

Instantly share code, notes, and snippets.

@nerestaren
Last active December 20, 2016 17:16
Show Gist options
  • Save nerestaren/a350667af502857e0f34c5a56bba0556 to your computer and use it in GitHub Desktop.
Save nerestaren/a350667af502857e0f34c5a56bba0556 to your computer and use it in GitHub Desktop.
Els rols que s'han escrit a Tadaima
SELECT DATE_FORMAT(FROM_UNIXTIME(post_time), '%d/%m/%Y %T'), username, forum_name, topic_title, (
SELECT COUNT(topic_id)
FROM posts as b
WHERE topic_id = posts.topic_id AND post_time <= posts.post_time
), CAST(CONCAT('https://tadaima.cat/topic', posts.topic_id, '.html#p', posts.post_id) AS CHAR) AS url
FROM posts
LEFT JOIN users on poster_id = user_id
LEFT JOIN topics on posts.topic_id = topics.topic_id
LEFT JOIN forums on topics.forum_id = forums.forum_id
WHERE posts.forum_id IN (39, 40, 41, 42)
ORDER BY post_time ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment