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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -