0

This question already has an answer here:

I have three features with the same ID, let's say "5". I also have a corresponding text table containing IDs among other info (for example a "category" value). I want to join the table with the features using the ID so that every feature has the same info from the text table. The problem is that only one feature gets joined, and the others are left out. How can I do the join properly?

EDIT: Image for more clarity. enter image description here

Desired shape attribute result:

enter image description here

marked as duplicate by underdark Jul 26 '15 at 11:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Does your table have multiple rows for the same ID? If so, you have a many-to-many relationship and it doesn't know which is supposed to go with which, so it's taking the first it finds of both. If there is only one row per ID in the table, it would be a many-to-one join and should work, as long as you're joining the table to the features. If joining the features to the table, you have a one-to-many join and again it doesn't know which one to pick so it just returns the first. There may be options in the join dialog to specify join type or 'keep all records'. – Chris W Mar 5 '15 at 1:42
  • Edited question for more clarity. – MapEngine Mar 5 '15 at 16:29
  • 1
    If that is the entirety of your text table, and 5 appears only in that one row, then it should work (although in your desired result table your 'something else' column should all be 'here' not 'there' and pkuid 4 should be 3). Did you correctly add the csv as a vector layer? In the join dialog, is Join layer the csv layer, Join field some_ID, and Target field someID? Think I have that right based on [this tutorial]. – Chris W Mar 5 '15 at 23:53
  • Oops. Didn't realize the link didn't work or I forgot to finish it. I meant this tutorial: qgistutorials.com/en/docs/performing_table_joins.html – Chris W Mar 6 '15 at 22:54
  • Thanks - the data I received was wrong (split up multipolygons) so the problem eventually solved itself. The answer is still useful of course. Yes, I did screw up my example there. – MapEngine Mar 24 '15 at 9:28