Code:
SELECT [User], [1stApproval] As Approved, [1st choice start] As Start, [1st choice start]+6 As End
FROM [ALMaster]
where [1stApproval]=true;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start]+7 As Start, [1st choice start]+13 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] >7 and [1st choice end] - [1st choice start] < 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start] +14 As Start, [1st choice start]+20 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start] As Start, [1st choice start]+6 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start]+7 As Start, [1st choice start]+13 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] As Start, [2nd choice start]+6 As End
FROM [ALMaster]
where [2ndApproval]=true;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start]+7 As Start, [2nd choice start]+13 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] >7 and [2nd choice end] - [2nd choice start] < 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] +14 As Start, [2nd choice start]+20 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] As Start, [2nd choice start]+6 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start]+7 As Start, [2nd choice start]+13 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] As Start, [3rd choice start]+6 As End
FROM [ALMaster]
where [3rdApproval]=true;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start]+7 As Start, [3rd choice start]+13 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] >7 and [3rd choice end] - [3rd choice start] < 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] +14 As Start, [3rd choice start]+20 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] As Start, [3rd choice start]+6 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start]+7 As Start, [3rd choice start]+13 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] As Start, [4th choice start]+6 As End
FROM [ALMaster]
where [4thApproval]=true;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start]+7 As Start, [4th choice start]+13 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] >7 and [4th choice end] - [4th choice start] < 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] +14 As Start, [4th choice start]+20 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] As Start, [4th choice start]+6 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start]+7 As Start, [4th choice start]+13 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] As Start, [5th choice start]+6 As End
FROM [ALMaster]
where [5thApproval]=true;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start]+7 As Start, [5th choice start]+13 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] >7 and [5th choice end] - [5th choice start] < 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] +14 As Start, [5th choice start]+20 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] As Start, [5th choice start]+6 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start]+7 As Start, [5th choice start]+13 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] As Start, [6th choice start]+6 As End
FROM [ALMaster]
where [6thApproval]=true;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start]+7 As Start, [6th choice start]+13 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] >7 and [6th choice end] - [6th choice start] < 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] +14 As Start, [6th choice start]+20 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] As Start, [6th choice start]+6 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start]+7 As Start, [6th choice start]+13 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;
SELECT [User], [1stApproval] As Approved, [1st choice start] As Start, [1st choice start]+6 As End
FROM [ALMaster]
where [1stApproval]=true;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start]+7 As Start, [1st choice start]+13 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] >7 and [1st choice end] - [1st choice start] < 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start] +14 As Start, [1st choice start]+20 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start] As Start, [1st choice start]+6 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [1stApproval] As Approved, [1st choice start]+7 As Start, [1st choice start]+13 As End
FROM [ALMaster]
where [1stApproval]=true and [1st choice end] - [1st choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] As Start, [2nd choice start]+6 As End
FROM [ALMaster]
where [2ndApproval]=true;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start]+7 As Start, [2nd choice start]+13 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] >7 and [2nd choice end] - [2nd choice start] < 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] +14 As Start, [2nd choice start]+20 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start] As Start, [2nd choice start]+6 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [2ndApproval] As Approved, [2nd choice start]+7 As Start, [2nd choice start]+13 As End
FROM [ALMaster]
where [2ndApproval]=true and [2nd choice end] - [2nd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] As Start, [3rd choice start]+6 As End
FROM [ALMaster]
where [3rdApproval]=true;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start]+7 As Start, [3rd choice start]+13 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] >7 and [3rd choice end] - [3rd choice start] < 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] +14 As Start, [3rd choice start]+20 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start] As Start, [3rd choice start]+6 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [3rdApproval] As Approved, [3rd choice start]+7 As Start, [3rd choice start]+13 As End
FROM [ALMaster]
where [3rdApproval]=true and [3rd choice end] - [3rd choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] As Start, [4th choice start]+6 As End
FROM [ALMaster]
where [4thApproval]=true;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start]+7 As Start, [4th choice start]+13 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] >7 and [4th choice end] - [4th choice start] < 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] +14 As Start, [4th choice start]+20 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start] As Start, [4th choice start]+6 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [4thApproval] As Approved, [4th choice start]+7 As Start, [4th choice start]+13 As End
FROM [ALMaster]
where [4thApproval]=true and [4th choice end] - [4th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] As Start, [5th choice start]+6 As End
FROM [ALMaster]
where [5thApproval]=true;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start]+7 As Start, [5th choice start]+13 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] >7 and [5th choice end] - [5th choice start] < 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] +14 As Start, [5th choice start]+20 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start] As Start, [5th choice start]+6 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [5thApproval] As Approved, [5th choice start]+7 As Start, [5th choice start]+13 As End
FROM [ALMaster]
where [5thApproval]=true and [5th choice end] - [5th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] As Start, [6th choice start]+6 As End
FROM [ALMaster]
where [6thApproval]=true;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start]+7 As Start, [6th choice start]+13 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] >7 and [6th choice end] - [6th choice start] < 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] +14 As Start, [6th choice start]+20 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start] As Start, [6th choice start]+6 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;
UNION SELECT [User], [6thApproval] As Approved, [6th choice start]+7 As Start, [6th choice start]+13 As End
FROM [ALMaster]
where [6thApproval]=true and [6th choice end] - [6th choice start] > 14;