I have a table with following structure
Table name: matches
That basically stores which product is matching which product. I need to process this table And store in a groups table like below.
Table Name: groups
group_ID
stores the MIN Product_ID
of the Product_IDS
that form a group. To give an example let's say
If A is matching B and B is Matching C then three rows should go to group table in format (A, A), (A, B), (A, C)
I have tried looking into co-related subqueries and CTE, but not getting this to implement.
I need to do this all in SQL.
Thanks for the help .