From d5b54c85ed5289f8f2a5c73aee7cea333ee9840e Mon Sep 17 00:00:00 2001 From: Jared Fantaye Date: Thu, 9 Feb 2023 20:41:22 +0100 Subject: [PATCH] Made some small adjustments to the database query --- .../newpipe/database/playlist/dao/PlaylistStreamDAO.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java b/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java index 015a77002..54fa2d53b 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java @@ -86,8 +86,9 @@ public interface PlaylistStreamDAO extends BasicDAO { @RewriteQueriesToDropUnusedColumns @Transaction - @Query("SELECT *, MIN(" + JOIN_INDEX + ") FROM " + STREAM_TABLE + " INNER JOIN " - + "(SELECT " + JOIN_STREAM_ID + "," + JOIN_INDEX + @Query("SELECT *, MIN(" + JOIN_INDEX + ")" + + " FROM " + STREAM_TABLE + " INNER JOIN" + + " (SELECT " + JOIN_STREAM_ID + "," + JOIN_INDEX + " FROM " + PLAYLIST_STREAM_JOIN_TABLE + " WHERE " + JOIN_PLAYLIST_ID + " = :playlistId)" + " ON " + STREAM_ID + " = " + JOIN_STREAM_ID @@ -97,7 +98,7 @@ public interface PlaylistStreamDAO extends BasicDAO { + " FROM " + STREAM_STATE_TABLE + " )" + " ON " + STREAM_ID + " = " + JOIN_STREAM_ID_ALIAS + " GROUP BY " + STREAM_ID - + " ORDER BY " + JOIN_INDEX + " ASC") + + " ORDER BY MIN(" + JOIN_INDEX + ") ASC") Flowable> getStreamsWithoutDuplicates(long playlistId);