• who's create date time stamp is first.

    I revised table B by adding a column and an additional vaue of A_ID:

    CREATE Table #B(B_ID INT,A_ID INT,City VARCHAR(5),State VARCHAR(2),Zip VARCHAR(10),Entered DATETIME)

    INSERT INTO #B

    SELECT 1,1,'xxx','TN','37013',GETDATE() UNION ALL

    SELECT 2,1,'yyy','TX','37012',GETDATE() - 40 UNION ALL

    SELECT 2,2,'aaa','UT','44030', GETDATE() - 5

    Then try this code:

    ;with numbered as(SELECT rowno=row_number() over

    (partition by A_id order by entered ASC),A_Id,B_Id,city,state,zip,entered from #B) --

    SELECT A.F_name,A.M_Name,A.L_Name1, N.A_id,N.City, N.State, N.Zip,N.Entered

    FROM numbered AS N

    INNER JOIN #A AS A ON A.A_id = N.A_id WHERE rowno = 1

    Results:

    F_nameM_NameL_Name1A_idCityStateZipEntered

    ABC1yyyTX370122010-06-21 11:42:13.187

    XYZ2aaaUT440302010-07-26 11:42:13.187

    If this is not what you require please repost listing what I missed, or how I misundersood your requirements.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]