-- 老体检重复的收费项目数据
SELECT B.FeeItemCode,B. ID AS FID,A.* FROM 
(
	SELECT * FROM PEIS.DBO.FeeItem WHERE NAME IN 
		(
			SELECT NAME FROM 
			(
				SELECT COUNT(NAME) AS C,NAME FROM PEIS.DBO.FeeItem  GROUP BY NAME 
			) T WHERE T.C>1
		) -- ORDER BY Name
) A
LEFT JOIN vi_FeeItem B ON A.Name=B.FeeItemName
ORDER BY Name,FID
 