Table design - parent with always exactly 1 or 2 children
The second option seems a bit odd. Why do you need the GroupDetails table instead of having a regular link table with 1 or 2 rows.

Groups                      
----------------------------
Id INT NOT NULL PRIMARY KEY 
TableAId INT NOT NULL       
TableBId INT NOT NULL
Sort TINYINT NOT NULL       


In any case if you don't need to support more than two links, I would choose the first option. There's nothing wrong with having a null value in a column, so that's not an issue. You also get rid of the cumbersome sort column, which for 2 values is pretty much overkill anyway.