MySQL Forums
Forum List  »  Newbie

sync records on common values
Posted by: smm samm
Date: October 31, 2018 01:45AM

Anybody can guide me (maybe Simple and fast if there is) to convert my data:

1 A C Z F G
2 G Q R C
3 Z G Q
4 C F
5 O P
6 O X Y J
7 A P X

I have this table with ~1,000,000 records like these 7 records that you see (In real Database A,B,C,... are words in string), Records 1 and 2 are common in G and C value and 2,3 and 1,3 and ...

I want to sync records if they have at least two common value like Records 1 & 2,3,4 (but record 5,6,7 haven't at least 2 shared values with others) and generate a list like this:

1 A C Z F G Q R
2 G Q R C A Z F
3 Z G Q A C F R
4 C F A Z G Q R
5 O P
6 O X Y J
7 A P X

at the end we must have 4 same records if we sort data and one others without sync:

1 A C F G Q R Z
2 A C F G Q R Z
3 A C F G Q R Z
4 A C F G Q R Z
5 O P
6 J O X Y
7 A P X

Thank you for any help.

Options: ReplyQuote

Written By
sync records on common values
October 31, 2018 01:45AM
October 31, 2018 12:02PM
October 31, 2018 11:57AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.