You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 07:26:18 +00:00
🆙 Fix Groups Forum SQL code
This commit is contained in:
@@ -135,16 +135,10 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT A.*, B.`id` AS `last_comment_id` " +
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT A.*, B.`id` AS `last_comment_id` " +
|
||||||
"FROM guilds_forums_threads A " +
|
"FROM guilds_forums_threads A " +
|
||||||
"JOIN (" +
|
"LEFT JOIN (" +
|
||||||
"SELECT * " +
|
"SELECT `thread_id`, MAX(`id`) AS `id`, MAX(`created_at`) AS `created_at` " +
|
||||||
"FROM `guilds_forums_comments` " +
|
"FROM `guilds_forums_comments` " +
|
||||||
"WHERE `id` IN (" +
|
"GROUP BY `thread_id`" +
|
||||||
"SELECT MAX(id) " +
|
|
||||||
"FROM `guilds_forums_comments` B " +
|
|
||||||
"GROUP BY `thread_id` AND B.`id` " +
|
|
||||||
"ORDER BY B.`id` " +
|
|
||||||
") " +
|
|
||||||
"ORDER BY `id` DESC " +
|
|
||||||
") B ON A.`id` = B.`thread_id` " +
|
") B ON A.`id` = B.`thread_id` " +
|
||||||
"WHERE A.`guild_id` = ? " +
|
"WHERE A.`guild_id` = ? " +
|
||||||
"ORDER BY A.`pinned` DESC, B.`created_at` DESC "
|
"ORDER BY A.`pinned` DESC, B.`created_at` DESC "
|
||||||
@@ -176,16 +170,10 @@ public class ForumThread implements Runnable, ISerialize {
|
|||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(
|
||||||
"SELECT A.*, B.`id` AS `last_comment_id` " +
|
"SELECT A.*, B.`id` AS `last_comment_id` " +
|
||||||
"FROM guilds_forums_threads A " +
|
"FROM guilds_forums_threads A " +
|
||||||
"JOIN (" +
|
"LEFT JOIN (" +
|
||||||
"SELECT * " +
|
"SELECT `thread_id`, MAX(`id`) AS `id`, MAX(`created_at`) AS `created_at` " +
|
||||||
"FROM `guilds_forums_comments` " +
|
"FROM `guilds_forums_comments` " +
|
||||||
"WHERE `id` IN (" +
|
"GROUP BY `thread_id`" +
|
||||||
"SELECT MAX(id) " +
|
|
||||||
"FROM `guilds_forums_comments` B " +
|
|
||||||
"GROUP BY `thread_id` AND b.`id`" +
|
|
||||||
"ORDER BY B.`id` " +
|
|
||||||
") " +
|
|
||||||
"ORDER BY `id` DESC " +
|
|
||||||
") B ON A.`id` = B.`thread_id` " +
|
") B ON A.`id` = B.`thread_id` " +
|
||||||
"WHERE A.`id` = ? " +
|
"WHERE A.`id` = ? " +
|
||||||
"ORDER BY A.`pinned` DESC, B.`created_at` DESC " +
|
"ORDER BY A.`pinned` DESC, B.`created_at` DESC " +
|
||||||
|
|||||||
Reference in New Issue
Block a user