trying to group datas of same id in a table to get less entries.
for exemple, id 1734815 can have {3209782, 3234332}
To do that : we can for exemple make a loop :
for ad_id in SELECT DISTINCT(ad_id) in table:
rows = SELECT duplicate_id FROM table WHERE ad_id = f{ad_id}
...
INSERT INTO new_table(ad_id, _duplicate_id) VALUES (ad_id, {rows});
Functional but think is not good : heavy and slow.
Is it possible to do that only with SQL ? Maybe with a sub request ? Thank you