As per what I understood you're trying to identify IndID that has latest UpdateDate faling within last 5 years. if that being case, you can use something likeSELECT IndIDFROM (SELECT IndID,MAX(UpdateDate) AS MaxUpdate FROM view GROUP BY IndID )tWHERE MaxUpdate >=DATEADD(yy,DATEDIFF(yy,0,GETDATE())-5,0)AND MaxUpdate <DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0)
the view would be likeSELECT IndID,UpdateDateFROM table1UNION ALLSELECT IndID,UpdateDateFROM table2....
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/