sql - Getting a unique grouping id from related columns -
i have table t 2 columns a, b
a b -- -- a1 b1 a1 b2 a2 b1 a3 b1 a3 b4 null b4 a3 null a5 b6
i generate unique grouping related columns. since first 7 rows either directly or indirectly related, should constitute 1 group (g1) , remaining row have own group (g2). trying stay away custom function , seek pure sql solution actual table has on 1 million rows.
Comments
Post a Comment