# How to get related data in Group By

**URL:** <https://forum.knime.com/t/how-to-get-related-data-in-group-by/14726>\
**Category:** KNIME Analytics Platform\
**Created:** [April 5, 2019, 4:43pm UTC](https://forum.knime.com/t/how-to-get-related-data-in-group-by/14726 "2019-04-05T16:43:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [April 5, 2019, 4:58pm UTC](https://forum.knime.com/t/how-to-get-related-data-in-group-by/14726/2 "2019-04-05T16:58:20Z")

</div>

The idea would be to keep a RowID or artificial ID together with the New ID and then join back all lines that are associated with it.

We had a similar discussion involving duplicates where instead of removing them one could keep the latest one:

> [@Remove rows with duplicate values](https://forum.knime.com/t/remove-rows-with-duplicate-values/11105/2):
>
> I set up a workflow to demonstrate how this could be done use group by to calculate how many duplicates there are (note: KNIME should introduce a generic COUNT(\*) function - I had to use a variable) if the count is larger then 1 it is a duplicate left join it back to the original data sort the data by ID and other variables if you want to keep one of the duplicates use the LAG column to identify which line is a 2nd, 3rd occurrence of a duplicate make a rule to keep just a single line of each …

---

_[View the full topic](https://forum.knime.com/t/how-to-get-related-data-in-group-by/14726)._
