DECLARE @MaxDate DATE SELECT @MaxDate = MAX(JobDate) from tbl_etsjob where JobDate <= @ReportDate print @MaxDate insert into @TempTable select JobID, UnitID , DepartmentID , JobDate , UnitStatus , Rig , Well , JobProcess , NPSJob , CrewStatus , Operator , js.JobStatus from tbl_etsjob j INNER JOIN tbl_JobStatus js on js.Ets_JobID = j.JobID where JobDate = @MaxDate
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)