[Qgis-user] 1 to many relationship does not allow to display the many

Janneke van Dijk janneke.qgis at gmail.com
Thu Sep 19 08:03:54 PDT 2019


Indeed

On 19/09/2019 17:56, DelazJ wrote:
> You mean, it's the selected field in the primary key drop-down menu in 
> DB manager when you want to add the layer?
>
> Le jeu. 19 sept. 2019 à 16:42, Janneke van Dijk 
> <janneke.qgis at gmail.com <mailto:janneke.qgis at gmail.com>> a écrit :
>
>     Hi Harrissou,
>     Thanks for the quick response - indeed, I indicated the assetid
>     which is a unique value. That did not solve the problem, alas...
>     Janneke
>
>     On 19/09/2019 17:31, DelazJ wrote:
>>     Hi Janneke,
>>
>>     Maybe you need a field that would uniquely identify the 170 asset
>>     rows (their primary key). You can use an ID field of your asset
>>     layer or construct one with row_number function?
>>
>>
>>     Regards,
>>     Harrissou
>>
>>     Le jeu. 19 sept. 2019 à 16:10, Janneke van Dijk
>>     <janneke.qgis at gmail.com <mailto:janneke.qgis at gmail.com>> a écrit :
>>
>>         Dear list,
>>
>>         I have a parent - child relationship set up between a table
>>         location (1,
>>         the parent) and a table assets (many, the child). The
>>         location table
>>         contains geometry, the asset table does not. I would like to
>>         be able to
>>         display each record in the asset table with the corresponding
>>         geometry
>>         of the location table - so if there are 3 assets at a certain
>>         location,
>>         I would like to display 3 points (each with identical geometry).
>>
>>         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 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.
>>
>>         Any insights deeply appreciated!
>>
>>         Janneke
>>
>>
>>         _______________________________________________
>>         Qgis-user mailing list
>>         Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>>         List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>         Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190919/ebd73abd/attachment-0001.html>


More information about the Qgis-user mailing list