[Qgis-user] query for Virtual Layer in relation to another layer

Jürgen E. Fischer jef at norbit.de
Fri Nov 4 05:15:34 PDT 2022


On Fri, 04. Nov 2022 at 12:32:29 +0100, Uwe Fischer via Qgis-user wrote:
> On Montag, 24. Oktober 2022 15:32, Reetz, Michael (NLPV) wrote:
> > you could try this:
> > select * from my_lines l join my_polys p on l.my_line_attribute like '%' + p.my_poly_attribute + '%'

> sorry for the delay, I had some days out of office.
> The query you sent is working (that is: no error message), but the resulting virtual layer is empty. Are there other ideas?

Not sure which engine virtual layers actually use, but I'd try || instead of + 

As in

sqlite> select '%' || 'foo' || '%';
%foo%

instead of

sqlite> select '%' + 'foo' + '%';
0


Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden            https://www.norbit.de
QGIS release manager (PSC)  Germany                 IRC: jef on Libera|OFTC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20221104/bc4bbf18/attachment.sig>


More information about the Qgis-user mailing list