From 789b2e20d1bc7a5460775ecfe863194378017a69 Mon Sep 17 00:00:00 2001 From: Isc Date: Tue, 5 May 2020 02:51:01 +0800 Subject: [PATCH] Bug fixed: move where before group by --- .../niedermann/owncloud/notes/persistence/NotesDatabase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java index c0e9a7ca..270dee85 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java @@ -391,8 +391,9 @@ public class NotesDatabase extends AbstractNotesDatabase { // Weird problem: If I use ? instead of concat directly, there is no result in the join table // TODO: Find a way to use ? instead of concat. String rawQuery = "SELECT " + category_title + ", COUNT(*) FROM " + table_category + " INNER JOIN " + table_notes + - " ON " + category_id + " = " + note_title + " GROUP BY " + category_id + - " WHERE " + table_category + "." + key_account_id + " = " + accountId; + " ON " + category_id + " = " + note_title + " WHERE " + table_category + "." + key_account_id + " = " + accountId + + " GROUP BY " + category_id; + Cursor cursor = getReadableDatabase().rawQuery(rawQuery, null); List categories = new ArrayList<>(cursor.getCount()); while (cursor.moveToNext()) {