Thanks webfred...The developer had written this query .. Iwas confused about multiple tables in From clause . I tested your query and my problamatic query on other tables which has less data.. and both the query has same result .. I dont understand why that developer has used three tables in from clause if he wanted to get the max from each table which your query also giving.. Can you please explain me the difference of this..Select @MaxRowCount_FileInstanceID = Isnull(Max(fi.FileInstanceID), 0), @MaxRowCount_DocumentInstanceID = Isnull(Max(di.DocumentInstanceID), 0), @MaxRowCount_DetailID = Isnull(Max(d.RecordID), 0) -- Isnull(Max(fi.FileInstanceID), 0), -- Isnull(Max(di.DocumentInstanceID), 0), --Isnull(Max(d.RecordID), 0)From dbo.DSFile fi with (nolock), dbo.DSDoc di with (nolock), dbo.DS d with (nolock)
Vijay is here to learn something from you guys.