• This is what I came up with

    --SAMPLE DATA

    IF OBJECT_ID('tempdb..#table_A') IS NOT NULL

    DROP TABLE #table_A;

    IF OBJECT_ID('tempdb..#table_B') IS NOT NULL

    DROP TABLE #table_B;

    CREATE TABLE #table_A (name varchar(20), [address] varchar(20));

    CREATE TABLE #table_B (name varchar(20), [address] varchar(20));

    INSERT #table_A VALUES ('Tai','#'),('Mike','#');

    INSERT #table_B VALUES

    ('Tai','123 Main St'),('Tai','897 Main St'),('Tai','123 Main St'),

    ('Mike','456 Broadway'),('Mike','456 Broadway');

    --The query

    WITH distinct_folks(name, r, [address]) AS

    (SELECT DISTINCTname, RANK() OVER (PARTITION BY name ORDER BY [address]),

    [address]

    FROM #table_B)

    SELECT b.name, b.[address]

    FROM distinct_folks AS b

    JOIN #table_A AS a ON b.name=a.name

    WHERE r=1

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001