• deepika_goyal (10/11/2012)


    Hello!!,

    NO body has replied on thiss.

    Please give some suggestion.

    Thanks!!

    Hello

    You are likely to get a much faster response if you provide DDL for your sample data. Here's your 'master' table, can you do the same with the 'slave' table? Make sure it runs without errors and that the data is correct before you post it. Thanks.

    CREATE TABLE #Master ([No] INT, [Type] VARCHAR(20), [Version] VARCHAR(10), [Date] DATE)

    SET DATEFORMAT DMY

    INSERT INTO #Master ([No], [Type], [Version], [Date])

    SELECT 1, 'Sales', 'V1.0', '01/10/2012' UNION ALL

    SELECT 2, 'Consumption', 'V1.10', '29/10/2012' UNION ALL

    SELECT 3, 'Daily Needs', 'V1.01', '13/08/2011' UNION ALL

    SELECT 4, 'Overall', 'V2.01', '01/09/2012'

    SELECT * FROM #Master

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden