Skip to content

Commit d5b54c8

Browse files
committed
Made some small adjustments to the database query
1 parent e26c038 commit d5b54c8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ default Flowable<List<PlaylistStreamEntity>> listByService(final int serviceId)
8686

8787
@RewriteQueriesToDropUnusedColumns
8888
@Transaction
89-
@Query("SELECT *, MIN(" + JOIN_INDEX + ") FROM " + STREAM_TABLE + " INNER JOIN "
90-
+ "(SELECT " + JOIN_STREAM_ID + "," + JOIN_INDEX
89+
@Query("SELECT *, MIN(" + JOIN_INDEX + ")"
90+
+ " FROM " + STREAM_TABLE + " INNER JOIN"
91+
+ " (SELECT " + JOIN_STREAM_ID + "," + JOIN_INDEX
9192
+ " FROM " + PLAYLIST_STREAM_JOIN_TABLE
9293
+ " WHERE " + JOIN_PLAYLIST_ID + " = :playlistId)"
9394
+ " ON " + STREAM_ID + " = " + JOIN_STREAM_ID
@@ -97,7 +98,7 @@ default Flowable<List<PlaylistStreamEntity>> listByService(final int serviceId)
9798
+ " FROM " + STREAM_STATE_TABLE + " )"
9899
+ " ON " + STREAM_ID + " = " + JOIN_STREAM_ID_ALIAS
99100
+ " GROUP BY " + STREAM_ID
100-
+ " ORDER BY " + JOIN_INDEX + " ASC")
101+
+ " ORDER BY MIN(" + JOIN_INDEX + ") ASC")
101102
Flowable<List<PlaylistStreamEntry>> getStreamsWithoutDuplicates(long playlistId);
102103

103104

0 commit comments

Comments
 (0)