
November 7th, 2003, 09:28 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 68
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
In the ideal case, you shouldn't have duplicates. Easier said than done, I guess, but all that it takes is having the proper primary key set up.
Assuming that per each distinct SOCIAL_SEC_NUM, the duplicate rows are identical, then the following should work:
SELECT
distinct SOCIAL_SEC_NUM, EMP_CODE, EMP_NAME, EMP_STATUS, COMPANY, OFFICE_CODE, OFFICE_TYPE
FROM
TBEMP
BTW, getting the duplicates is done via:
SELECT
SOCIAL_SEC_NUM, COUNT(SOCIAL_SEC_NUM)
FROM
TBEMP
GROUP BY
SOCIAL_SEC_NUM
HAVING
COUNT(SOCIAL_SEC_NUM) > 1);
Regards,
Dan
|