From 0611dc45eb2970131f70689c57806ab69a28e06d Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 7 Aug 2018 09:55:14 +0000 Subject: [PATCH] Minor query improvements --- app/src/main/java/eu/faircode/email/DaoMessage.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index d45aee90fa..69b3272e7c 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -40,7 +40,7 @@ public interface DaoMessage { " WHERE folder.type = '" + EntityFolder.TYPE_INBOX + "'" + " AND (NOT ui_hide OR :debug)" + " GROUP BY thread" + - " ORDER BY message.received DESC") + " ORDER BY received DESC") // in theory the message id and thread could be the same DataSource.Factory pagedUnifiedInbox(boolean debug); @@ -48,8 +48,8 @@ public interface DaoMessage { ", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_hide) AS count" + ", SUM(CASE WHEN message.ui_seen THEN 0 ELSE 1 END) AS unseen" + ", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" + - " FROM message" + - " JOIN folder ON folder.id = message.folder" + + " FROM folder" + + " JOIN message ON folder = folder.id" + " WHERE folder.id = :folder" + " AND (NOT ui_hide OR :debug)" + " GROUP BY thread" +