D
dtoney
I'm trying to calculate the business week by looking at logdate. Below is the
entire syntax for the select query with the case statement indented for
easier reading:
SELECT tblINQ.LOGDATE, tblINQ.Ticket, tblINQ.TicketDTM, tblINQ.AltKeyID,
tblINQ.OrigParentChild, tblINQ.SevCd, tblINQ.EDIType, tblINQ.QueOwnerDesc,
tblINQ.Origination, tblINQ.ServiceType, tblINQ.CategoryType, tblINQ.TSCType,
tblINQ.LoggedByDivCd, tblINQ.LoggedByDeptCd, tblINQ.LoggedByID,
tblINQ.OwnerDivNbr, tblINQ.OwnerDeptCd, tblINQ.OwnerID, tblINQ.RespTech,
tblINQ.SupportArea, tblINQ.StatusCd, tblINQ.StatusType, tblINQ.StatusDate,
tblINQ.StatusTime, tblINQ.ActualCloseDt, tblINQ.OwnerAtClose,
tblINQ.CustDivCd, tblINQ.Organization, tblINQ.CustID, tblINQ.CustCostCenter,
tblINQ.CustLOB, tblINQ.BusinessArea, tblINQ.BusinessAreaOrig,
tblINQ.CustEmpNo, tblINQ.CustLastName, tblINQ.CustFirstName,
tblINQ.CustLocCd, tblINQ.CustLocName, tblINQ.CustClass, tblINQ.LocationDesc,
tblINQ.ReqLastName, tblINQ.ReqFirstName, tblINQ.ResolutionCd,
tblINQ.ResolutionDesc, tblINQ.Region, tblINQ.TypeCd, tblINQ.AreaCd,
tblINQ.ProblemCd, tblINQ.SymptomCd, tblINQ.TypeDesc, tblINQ.AreaDesc,
tblINQ.ProblemDesc, tblINQ.SymptomDesc, tblREQ.ReqLogDate, tblREQ.ReqTicket,
tblREQ.ReqTicketDTM, tblREQ.ReqSeqNbr, tblREQ.ReqVerbiage, tblREQ.MaintDTM AS
tblREQ_MaintDTM, tblIDT.ActualProblem, tblIDT.ActualArea, tblIDT.AssetCode,
tblIDT.AssetName, tblIDT.CorrectiveActionCode, tblIDT.CorrectiveActionDesc,
tblIDT.RootCauseCode, tblIDT.RootCauseDesc,
CASE WHEN WEEKDAY(tblINQ.LOGDATE) = 1 THEN INFOP.VINQUIRY.INQ_STATUS_DATE
WHEN WEEKDAY(tblINQ.LOGDATE) = 2 THEN (tblINQ.LOGDATE) - 1 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 3 THEN (tblINQ.LOGDATE) - 2 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 4 THEN (tblINQ.LOGDATE) - 3 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 5 THEN (tblINQ.LOGDATE) - 4 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 6 THEN (tblINQ.LOGDATE) - 5 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 7 THEN (tblINQ.LOGDATE) - 6 DAY ELSE NULL END AS
WEEK ,
INTO tblData
FROM tblINQ INNER JOIN (tblIDT INNER JOIN tblREQ ON
tblIDT.Ticket=tblREQ.ReqTicket) ON tblINQ.Ticket=tblREQ.ReqTicket
WHERE (((tblINQ.LOGDATE)>Date()-90) AND ((tblINQ.LoggedByDivCd)="45") AND
((tblINQ.LoggedByDeptCd)="820") AND ((tblREQ.ReqSeqNbr)=1));
I get a syntax error MissingOperator. Please Help!
entire syntax for the select query with the case statement indented for
easier reading:
SELECT tblINQ.LOGDATE, tblINQ.Ticket, tblINQ.TicketDTM, tblINQ.AltKeyID,
tblINQ.OrigParentChild, tblINQ.SevCd, tblINQ.EDIType, tblINQ.QueOwnerDesc,
tblINQ.Origination, tblINQ.ServiceType, tblINQ.CategoryType, tblINQ.TSCType,
tblINQ.LoggedByDivCd, tblINQ.LoggedByDeptCd, tblINQ.LoggedByID,
tblINQ.OwnerDivNbr, tblINQ.OwnerDeptCd, tblINQ.OwnerID, tblINQ.RespTech,
tblINQ.SupportArea, tblINQ.StatusCd, tblINQ.StatusType, tblINQ.StatusDate,
tblINQ.StatusTime, tblINQ.ActualCloseDt, tblINQ.OwnerAtClose,
tblINQ.CustDivCd, tblINQ.Organization, tblINQ.CustID, tblINQ.CustCostCenter,
tblINQ.CustLOB, tblINQ.BusinessArea, tblINQ.BusinessAreaOrig,
tblINQ.CustEmpNo, tblINQ.CustLastName, tblINQ.CustFirstName,
tblINQ.CustLocCd, tblINQ.CustLocName, tblINQ.CustClass, tblINQ.LocationDesc,
tblINQ.ReqLastName, tblINQ.ReqFirstName, tblINQ.ResolutionCd,
tblINQ.ResolutionDesc, tblINQ.Region, tblINQ.TypeCd, tblINQ.AreaCd,
tblINQ.ProblemCd, tblINQ.SymptomCd, tblINQ.TypeDesc, tblINQ.AreaDesc,
tblINQ.ProblemDesc, tblINQ.SymptomDesc, tblREQ.ReqLogDate, tblREQ.ReqTicket,
tblREQ.ReqTicketDTM, tblREQ.ReqSeqNbr, tblREQ.ReqVerbiage, tblREQ.MaintDTM AS
tblREQ_MaintDTM, tblIDT.ActualProblem, tblIDT.ActualArea, tblIDT.AssetCode,
tblIDT.AssetName, tblIDT.CorrectiveActionCode, tblIDT.CorrectiveActionDesc,
tblIDT.RootCauseCode, tblIDT.RootCauseDesc,
CASE WHEN WEEKDAY(tblINQ.LOGDATE) = 1 THEN INFOP.VINQUIRY.INQ_STATUS_DATE
WHEN WEEKDAY(tblINQ.LOGDATE) = 2 THEN (tblINQ.LOGDATE) - 1 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 3 THEN (tblINQ.LOGDATE) - 2 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 4 THEN (tblINQ.LOGDATE) - 3 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 5 THEN (tblINQ.LOGDATE) - 4 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 6 THEN (tblINQ.LOGDATE) - 5 DAYS WHEN
WEEKDAY(tblINQ.LOGDATE) = 7 THEN (tblINQ.LOGDATE) - 6 DAY ELSE NULL END AS
WEEK ,
INTO tblData
FROM tblINQ INNER JOIN (tblIDT INNER JOIN tblREQ ON
tblIDT.Ticket=tblREQ.ReqTicket) ON tblINQ.Ticket=tblREQ.ReqTicket
WHERE (((tblINQ.LOGDATE)>Date()-90) AND ((tblINQ.LoggedByDivCd)="45") AND
((tblINQ.LoggedByDeptCd)="820") AND ((tblREQ.ReqSeqNbr)=1));
I get a syntax error MissingOperator. Please Help!