SELECT mt1.Name, mt1.ID FROM MyTable mt1 ; >> JOIN MyTable mt2 ON mt1.ID = mt2.Id AND mt2.Name == 'D'