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

Alexandre Neto senhor.neto at gmail.com
Thu Sep 19 08:04:46 PDT 2019


It sounds like a bug...
Can you provide a data sample and project. Also, what QGIS version are you
using?

Alexandre Neto

On Thu, Sep 19, 2019 at 3:57 PM Janneke van Dijk <janneke.qgis at gmail.com>
wrote:

> Hi Alexandre,
> Also thanks for the quick response!
>
> 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.
>
> I first had a simple join, then saw an example of a cross join and tried
> that in the hope that that would make a difference.
>
>
>
>> 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.
>
> I have a relationship, and the assets will show up in the form of the
> location when you click on the location (including locations with several).
> However, it doesn't allow me to label the location with information from
> the assets, or create symbology based on asset information.
>
> What puzzles me is that the query results in 170 records, I would have
> expected the geometry to be joined to each of the 170 attribute records and
> then be displayed - so where does the filter with a 100 suddenly come from?
> (Is this a bug?)
>
> As a work around I think I could get xy coordinates of the location, then
> join them to the assets, export to csv and import again as a delimited text
> layer for display purposes.
>
> I was hoping someone could either explain why this result makes sense, or
> that I just made a mistake somewhere...any more thoughts?
>
> Thanks for sharing your thoughts!
>
> Janneke
>
>
> Alexandre Neto
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190919/d7264c22/attachment.html>


More information about the Qgis-user mailing list