SELECT fullname as fname INTO #temp1 FROM TestTable GROUP BY fullname HAVING (COUNT(fullname) > 1); SELECT (fullname+ '[' + username + ']') from TestTable thetest right JOIN #temp1 T on thetest.fullname = T.fname UNION SELECT fullname FROM TestTable GROUP BY fullname HAVING ( COUNT(fullname) = 1 ); drop TABLE #temp1;
select fullname||username from table where fullname in( SELECT fullname FROM Table group by fullname having count(*)>1) union select fullname from table group by fullname having count(*)=1
Select fullname, username, dept from tablename tn Join tablename on tn.fullname = tablename.fullname and tn.id <> tablename.id
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)