SELECT SOD.Job_No, SOD.ContractReceived_F, SOD.DesignReview_F, SOD.OrderPlotPlan_S, SOD.OrderPlotPlan_F, SOD.OrderTrusses_S, SOD.OrderTrusses_F, SOD.OrderHeatCalcs_S, SOD.OrderHeatCalcs_F, SOD.PermitRelease_S, SOD.PermitRelease_F, SOD.IntSelectionsAppt_F, SOD.ExcavationFile_S, SOD.ExcavationFile_F, SOD.FramingFile_S, SOD.FramingFile_F, SOD.FinishingFile_S, SOD.FinishingFile_F, SOD.StartDate, SOD.Possession, SOD.Expected_Occupancy AS ClosingDate, SOD.Description, SOD.ActualFinish AS LastTaskCompleted FROM (SELECT a.Job_No, a.ContractReceived_F, a.DesignReview_F, z.OrderPlotPlan_S*, Row_number() OVER (ORDER BY a.Job_No) AS RowNum FROM dbo.ScheduledatesFF AS a INNER JOIN dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN dbo.maxscheddate AS m ON a.Job_No = m.Job_No) AS SOD WHERE SOD.RowNum BETWEEN 0 AND 2 SELECT SOD.Job_No, SOD.ContractReceived_F, SOD.DesignReview_F, SOD.OrderPlotPlan_S, SOD.OrderPlotPlan_F, SOD.OrderTrusses_S, SOD.OrderTrusses_F, SOD.OrderHeatCalcs_S, SOD.OrderHeatCalcs_F, SOD.PermitRelease_S, SOD.PermitRelease_F, SOD.IntSelectionsAppt_F, SOD.ExcavationFile_S, SOD.ExcavationFile_F, SOD.FramingFile_S, SOD.FramingFile_F, SOD.FinishingFile_S, SOD.FinishingFile_F, SOD.StartDate, SOD.Possession, SOD.Expected_Occupancy AS ClosingDate, SOD.Description, SOD.ActualFinish AS LastTaskCompleted FROM (SELECT a.Job_No, a.ContractReceived_F, a.DesignReview_F, z.OrderPlotPlan_S, Row_number() OVER (ORDER BY a.Job_No) AS RowNum FROM dbo.ScheduledatesFF AS a INNER JOIN dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN dbo.maxscheddate AS m ON a.Job_No = m.Job_No) AS SOD WHERE SOD.RowNum BETWEEN 0 AND 2 SELECT SOD.Job_No, SOD.ContractReceived_F, SOD.DesignReview_F, SOD.OrderPlotPlan_S, SOD.OrderPlotPlan_F, SOD.OrderTrusses_S, SOD.OrderTrusses_F, SOD.OrderHeatCalcs_S, SOD.OrderHeatCalcs_F, SOD.PermitRelease_S, SOD.PermitRelease_F, SOD.IntSelectionsAppt_F, SOD.ExcavationFile_S, SOD.ExcavationFile_F, SOD.FramingFile_S, SOD.FramingFile_F, SOD.FinishingFile_S, SOD.FinishingFile_F, SOD.StartDate, SOD.Possession, SOD.Expected_Occupancy AS ClosingDate, SOD.Description, SOD.ActualFinish AS LastTaskCompleted FROM (SELECT *, Row_number() OVER (ORDER BY a.Job_No) AS RowNum FROM dbo.ScheduledatesFF AS a INNER JOIN dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN dbo.maxscheddate AS m ON a.Job_No = m.Job_No) AS SOD WHERE SOD.RowNum BETWEEN 0 AND 2 SELECT SOD.Job_No, SOD.ContractReceived_F, SOD.DesignReview_F, SOD.OrderPlotPlan_S, SOD.OrderPlotPlan_F, SOD.OrderTrusses_S, SOD.OrderTrusses_F, SOD.OrderHeatCalcs_S, SOD.OrderHeatCalcs_F, SOD.PermitRelease_S, SOD.PermitRelease_F, SOD.IntSelectionsAppt_F, SOD.ExcavationFile_S, SOD.ExcavationFile_F, SOD.FramingFile_S, SOD.FramingFile_F, SOD.FinishingFile_S, SOD.FinishingFile_F, SOD.StartDate, SOD.Possession, SOD.Expected_Occupancy AS ClosingDate, SOD.Description, SOD.ActualFinish AS LastTaskCompleted FROM (SELECT a.Job_No, a.ContractReceived_F, a.DesignReview_F, z.OrderPlotPlan_S, Row_number() OVER (ORDER BY a.Job_No) AS RowNum FROM dbo.ScheduledatesFF AS a INNER JOIN dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN dbo.maxscheddate AS m ON a.Job_No = m.Job_No) AS SOD WHERE SOD.RowNum BETWEEN 0 AND 2 lang-sql