I have a simple table generated with a subquery that applies many different filters.
| project
1 | Hello
2 | Hello 2.0
3 | Ordinary Sheep
4 | Sheep
The next step is to remove projects with very similar names (for example, if a project has the same name but followed by a 2.0).
In this case I need my query to remove Project 2.0 from the results. This little issue is more challenging than I expected.
My best bet seems to be this one bellow where I correctly identify the project that should be excluded, but if I invert the operation I end up with duplicated data because due to the self join.
SELECT
q1.name,
q2.name
FROM subquery q1
JOIN subquery q2 ON q1.name LIKE q2.name || '%'
WHERE q1.id <> q2.id;
Thank you so much!