OK. Thanks. I am pulling from a poorly built table and database and inserting into a new database and tables. All works fine except for the source table could and does have duplicate persons. Shouldn't be duplicated but they are. So for example, here is just 5 records (from 7000):
[FirstName] | [MiddleName] | [LastName] | [Suffix] | [SSN] | [OwnerNumber]
** GUROWITZ,ANDREW,SCOTT (PRESIDENT) 000000000160
**LANE,WILLIAM, 111111111162
MICHAELS (PRESIDENT)BEYER 222222222163
**KOREN,DANIEL,L 333333333166
**KOREN,DANIEL,L 333333333174
JAMESEKOONS 444444444182
(Yes, there are astericks in name fields. I clean that up later.)
See how "Daniel" is int there twice. Even with the same ssn? I basically need to somehow select the latest, most bottom version of Daniel. The own showing OwnerNumber = 174.
**Those OwnerNumbers are FKs which I'll extract and save later. I cannot just trash them. I'll insert them into a related table once I over come this.
**SSNs are ignored in my INSERT. I come back and grab those later.
So as you can guess, I just used this to grab these records.....
(SELECT [FirstName],[MiddleName],[LastName],[Suffix],[SSN], [OwnersNumber]
FROM ONBOARD.dbo.DealershipOwners WHERE DealershipOwnersID BETWEEN 10 AND 15)
Any idea how I can grab these most bottom version of "Daniel" (and others)?