• Could you please post your sample data as DDL statements? I'll give you an example but right now, I don't have time to do it with all the tables. This way I can start to work directly on the problem and will identify any possible problems with datatypes.

    CREATE TABLE GLCMS(

    IDN char(4),

    KMSO char(4),

    KCVA char(4),

    FSCVA char(1))

    INSERT INTO GLCMS

    SELECT '0099', '0001', '0007', 'N' UNION ALL

    SELECT '0099', '0001', '000D', 'A' UNION ALL

    SELECT '0099', '0003', '0007', 'A' UNION ALL

    SELECT '0099', '0003', '000D', 'A' UNION ALL

    SELECT '0099', '0009', '0007', 'A' UNION ALL

    SELECT '0099', '000A', '000D', 'A'

    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