Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29788

Alternative for Window function in SQLite version < 3.25.0?

$
0
0

I want retrieve the last 10 rows for each chat_id match in a table.

This works perfect:


SELECT *
FROM 
    (SELECT a.*,
         row_number()
        OVER (PARTITION BY a.chat_id
    ORDER BY  a.timestamp DESC ) AS row
    FROM messages a ) AS foo
WHERE row <= 10

But when i put this code on my React Native app, it throws and error, and its because this its only supported in SQLite 3.25.0 and above.

https://developer.android.com/reference/android/database/sqlite/package-summary.html

Is there another way to do this? I'm trying to avoid multiple queries to SQL.


Viewing all articles
Browse latest Browse all 29788

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>