How do you filter a layer on a joined table in QGIS?

How do you filter a layer on a joined table in QGIS?

I am attempting to do a join in QGIS between a SQL Server Spatial table and a non-spatial table (on a single integer field). I was able to add both successfully and make the join, but the query builder dialog only shows the fields from the spatial table.

I also tried setting a feature filter on the non-spatial table before joining to the spatial table, but that filter was not honored (no error, but no affect on the layer).

QGIS version: 2.12.1-Lyon QGIS code revision: 16760fd

Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)

I found these 2 feature requests which seem to confirm that you can't filter the layer on the joined table. The workaround is to export the layer to shapefile as @wiltomap suggested (provided the data is static).

Not possible to define subset of layer using field from joined table

query / filter on attribute tables with external tables joined

Watch the video: Show Only Selected Features in the QGIS Attribute Table