aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-11-07 09:33:03 +0300
committerGravatar Vitaly Takmazov2021-11-07 09:33:13 +0300
commit8bac426e420e100ff68f0d9bf3a6be3f3f53ffb0 (patch)
tree4f1e0ac792a4fd8e6c805030114c501b6e4a3271 /src/main/java/com/juick/service
parent6c3cc808f7358e19aa41db585e8450798e729499 (diff)
Fix top query
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 7e366a01..0a010929 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -987,7 +987,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
+ "INNER JOIN messages ON messages.message_id = favorites.message_id "
+ "LEFT JOIN messages_tags ON messages_tags.message_id = messages.message_id "
+ "WHERE COALESCE(messages_tags.tag_id, 0) != 2 AND favorites.ts > TIMESTAMPADD(HOUR, -2, CURRENT_TIMESTAMP) "
- + "AND favorites.user_id != 2 GROUP BY messages.message_id HAVING COUNT(DISTINCT favorites.user_id) > 1;",
+ + "AND NOT EXISTS (SELECT * FROM favorites WHERE user_id = 2) GROUP BY messages.message_id HAVING COUNT(DISTINCT favorites.user_id) > 1;",
Integer.class);
}