<div dir="ltr"><div>Hi QGISers,</div><div><br></div><div>I struggled and failed to find a way to use QGIS expressions functions in order to select features based on sorting on different fields. I played with aggregates, arrays, maps but couldn't find how to control sort order (and imbricate it). I finally generated virtual layers to do the work but would really love to select and not extract.</div><div>The need in SQL is something like:</div><div><pre>select somefields, afield, st_length(geometry) as longueur, geometry
from mylayer
where longueur < 10
<b>order by afield desc, longueur asc</b>
limit 5<br><br></pre>Any help would be more than welcome.</div><div>Thanks in advance</div><div><br></div><div>Kind regards,</div><div>Harrissou<br></div></div>