• drew.allen (12/2/2016)


    JALLY (12/2/2016)


    Your solution above will create a conflict between columns that rely on the the sub queries for their source of data and the multi part identifier 'inv.active' will not be bound to the inventory table because it is outside of a sub query: for example :osu.SalesPerson is from the following subquery part identifier. if i add the where clause at the end of the script. the where clause will not be able to bind on to the inventory table due to the 2nd sub query bound by osu following it.

    No, it won't. You have nested subqueries and inv is defined in the outer subquery, so it can be used ANYWHERE in the main subquery. The second subquery creates a new scope WITHIN the scope of the main subquery. It does not close the scope of the main subquery.

    Drew

    Thanks a lot drew, i did as you advised above and the script worked perfectly.

    I learn from the footprints of giants......