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.