Hey all so I need to convert this daily report I run every morning to T-SQL, however I am having extreme difficulty converting the IIF statement I have in the Where clause of my access report to SQL. Here is what I currently have and works fine -
SELECT JJobs.Job, JJobs.RNum, JJobs.LogDT, Lst.LName AS JobStatus
FROM Sites INNER JOIN
JJobs ON Sites.Site = JJobs.Site INNER JOIN
City ON Sites.CityID = City.CityID INNER JOIN
Lst INNER JOIN
Lst AS Lst_1 ON LEFT(Lst.LID, 1) = Lst_1.LID ON JJobs.JS = Lst.LID
WHERE (Lst.TID = 'JS') AND (Lst_1.TID = 'JST')
What I need to add now is this IIF statement I have in the Criteria in my Access DB for the LogDT - >IIf(Weekday(Date())=2,Date()-3,Date()-1).
The report Basically looks at the current day and pulls Jobs that have the previous date on them and if its a Monday it will pull jobs opened on Friday/Sat/Sunday, thats the whole point of that IIF statement. Any help would be Awesome!
SELECT JJobs.Job, JJobs.RNum, JJobs.LogDT, Lst.LName AS JobStatus
FROM Sites INNER JOIN
JJobs ON Sites.Site = JJobs.Site INNER JOIN
City ON Sites.CityID = City.CityID INNER JOIN
Lst INNER JOIN
Lst AS Lst_1 ON LEFT(Lst.LID, 1) = Lst_1.LID ON JJobs.JS = Lst.LID
WHERE (Lst.TID = 'JS') AND (Lst_1.TID = 'JST')
What I need to add now is this IIF statement I have in the Criteria in my Access DB for the LogDT - >IIf(Weekday(Date())=2,Date()-3,Date()-1).
The report Basically looks at the current day and pulls Jobs that have the previous date on them and if its a Monday it will pull jobs opened on Friday/Sat/Sunday, thats the whole point of that IIF statement. Any help would be Awesome!