• Another option:

    SELECTtable1.column1,

    '99',

    left(table1.column2,2),

    max(table1.column3),

    'Yes',

    'Test'

    FROMtable1

    LEFT

    JOINtable2 ON ltrim(rtrim(table1.column1))+ltrim(rtrim(left(table1.column2,2)))

    = ltrim(rtrim(table2.column1))+ltrim(rtrim(left(table2.column2,2)))

    WHERE table2.column1 IS NULL

    AND table1.column4 = 'Yes'

    GROUP BY table1.column1,left(table1.column2,2)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2