[Qgis-user] Expression to sort by multiple fields

DelazJ delazj at gmail.com
Mon Dec 5 05:47:00 PST 2022


Hi QGISers,

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.
The need in SQL is something like:

select somefields, afield, st_length(geometry) as longueur, geometry
from mylayer
where longueur < 10*order by afield desc, longueur asc*
limit 5

Any help would be more than welcome.
Thanks in advance

Kind regards,
Harrissou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20221205/f2393f60/attachment.htm>


More information about the Qgis-user mailing list