select * from t where col in(select col from t as t2 group by col having count(*) > 1); 或 select T.* from T join (select col from T group by col having count(*) > 1) as T2 on T.col= T2.col
sql server环境下,供参考: select A列,iif(RowNum=0,B列,B列+cast(RowNum as varchar(10))) B列 from (select A列,B列,row_number() over(partition by B列 order by A列)-1 RowNum from table_A) a本回答被提问者和网友采纳