SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY x.WaiveState WHEN '1' THEN 'Waived' WHEN '2' THEN 'Pending' WHEN '3' THEN 'Not Waived' END) AS rowID FROM (SELECT TOP 100 PERCENT FULL_NAV_TREE.Block_Name, FULL_NAV_TREE.Block_Name_Inst, v_Run_Corners.CTV, STA_Run.CT_on_create, STA_Run.Comment, STA_Setup.EndPoint, STA_Run.FK_Mode, STA_Run.FK_Run_Corners, FULL_NAV_TREE.Layout_Rundir_Name, Mode.Mode, Mode.ModeType, FULL_NAV_TREE.PK_Layout_Rundir, FULL_NAV_TREE.PK_Project, v_Run_Corners.PK_Run_Corners, FULL_NAV_TREE.PK_STA_Rundir, FULL_NAV_TREE.PK_Synth_Rundir, STA_Setup.Path_Group, FULL_NAV_TREE.ProjName_Revision, FULL_NAV_TREE.RTL_to_synthesis, ReportLink.ReportLink_URL AS ReportLink, STA_Setup.Run_idSTARun, FULL_NAV_TREE.STA_Rundir_Name, STA_Setup.Slack, STA_Setup.StartPoint, Mode.SubMode, FULL_NAV_TREE.Synth_Install_Name, FULL_NAV_TREE.Synth_Rundir_Name, v_Run_Corners.WCorner, v_Run_Corners.WTemp, v_Run_Corners.WVoltage, STA_Setup.WaiveState, FULL_NAV_TREE.idBlock_Props, Mode.idMode, STA_Run.idSTARun, STA_Setup.idSTASetup FROM FULL_NAV_TREE JOIN STA_Run ON FULL_NAV_TREE.PK_STA_Rundir = STA_Run.FK_STA_Rundir JOIN STA_Setup ON STA_Setup.Run_idSTARun = STA_Run.idSTARun JOIN v_Run_Corners ON v_Run_Corners.PK_Run_Corners = STA_Run.FK_Run_Corners JOIN Mode ON Mode.idMode = STA_Run.FK_Mode JOIN ReportLink ON ReportLink.idReportLink = STA_Run.Rlink_idReportLink WHERE ((('1'='1' AND (FULL_NAV_TREE.ProjName_Revision = 'BEER100 D1' AND FULL_NAV_TREE.ProjName_Revision IS NOT NULL))) AND ((((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1510' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1509' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1511' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir = '23863' AND FULL_NAV_TREE.PK_Synth_Rundir IS NOT NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir = '223045' AND FULL_NAV_TREE.PK_Layout_Rundir IS NOT NULL) AND (FULL_NAV_TREE.PK_STA_Rundir = '3095532' AND FULL_NAV_TREE.PK_STA_Rundir IS NOT NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1513' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1508' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1507' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1512' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1514' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1515' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL)) OR ((FULL_NAV_TREE.PK_Project = '295' AND FULL_NAV_TREE.PK_Project IS NOT NULL) AND (FULL_NAV_TREE.idBlock_Props = '1506' AND FULL_NAV_TREE.idBlock_Props IS NOT NULL) AND '1'='1' AND (FULL_NAV_TREE.PK_Synth_Rundir IS NULL) AND (FULL_NAV_TREE.PK_Layout_Rundir IS NULL) AND (FULL_NAV_TREE.PK_STA_Rundir IS NULL))) AND '1'='1')) ORDER BY CASE STA_Setup.WaiveState WHEN '1' THEN 'Waived' WHEN '2' THEN 'Pending' WHEN '3' THEN 'Not Waived' END) x) y WHERE y.rowID BETWEEN 1 AND 75 -