[Qgis-user] 1 to many relationship does not allow to display the many
Alexandre Neto
senhor.neto at gmail.com
Thu Sep 19 07:32:05 PDT 2019
Hi
On Thu, Sep 19, 2019 at 3:10 PM Janneke van Dijk <janneke.qgis at gmail.com>
wrote:
>
> What I can do with the DB manager is:
>
> select location_point.geom, asset_point.assetid, location_point.fid
> from asset_point cross join location_point on asset_point.locationid =
> location_point.fid
>
>
This should work, but why the CROSS JOIN? a simple join should be enough.
> this query yields 170 records, corresponding with the number of records
> in the assets table. When I load as a new layer, the result is a table
> with 170 records, but 100 filtered (the total number of locations). I
> chose assetid to be the unique id (which it is).
>
> Is that expected behaviour? How else can I display all the records in
> the assets table (instead of only the 100 that are filtered now)? I know
> I can do it in Postgres but for my purpose now I don't want to go there.
>
>
An alternative is to create a relation between the two tables, the assets
will show in the location feature form. You can even add more assets to a
certain location.
Check more info here:
https://docs.qgis.org/3.4/en/docs/user_manual/working_with_vector/attribute_table.html?highlight=relation#introducing-1-n-relations
Hope it helps.
Alexandre Neto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190919/94306cc1/attachment.html>
More information about the Qgis-user
mailing list