So here is the problem:
1, 2And the output from the query we want is:
All rows with a matching sister "a=b" relation should be "merged".
Lukas found one quite good way using exists in a self-join.
Any RDBMS goes, ANSI SQL is an advantage but not necessary. Analytics perhaps?
Nicest/fastest/cleanest query wins. Post any questions as comments.
E-mail me or post your solution as a comment to this blog.
See Lukas' invite to the challenge. :)
Thanks and good luck!