Different dataview result when changing limit

What I’m trying to do

Hi I’m trying to make a list using dataview to show my recent notes
but for some reason it doesn’t work when i set the limit to 5

so this is my recent notes

image

so I do this

list 
from "6 - Main Notes"
limit 5
SORT file.mtime desc

but it shows different notes than what it should be

then when i try to set the limit to 50

it gets closer to the recent note I make.

is there anything I could do to fix this

A query is executed in a line by line style so when you do LIMIT 5 before your SORT line, you take whichever first five files from your folder of notes, and sort those. You need to sort the file list, before you limit to only the five you’re interested in.

In other words, try:

```dataview
list 
from "6 - Main Notes"
SORT file.mtime desc
limit 5
```
1 Like