Good evening,
I am trying compare a value from one table to another, and have an new field populate. I am using a Case Statement in order to try to accomplish this task.
The error is: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 9
Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'THEN'.
My Code is:
Select
ip.DataDt
,ip.LoanNum
,ip.RecordNum
,ip.VendorName
,ip.InProcessReasonDesc
,CurrentStatus =
CASE
WHEN InProcessReasonDesc(SELECT InProcessReasonDesc FROM StatusInfo_Outgoing)
!= InProcessReasonDesc(Select InProcessReasonDesc FROM VendorDataExchange.dbo.InProcessDesc_Incoming)
THEN 'Current'
ELSE 'Outdated'
END;
FROM VendorDataExchange.dbo.InProcessDesc_Incoming ip
LEFT JOIN VendorDataExchange.dbo.LoanInfo_Outgoing
ON ip.RecordNum = VendorDataExchange.dbo.LoanInfo_Outgoing.RecordNum
LEFT JOIN ProdAdmin.dbo.ProdAdminTracking
ON ip.RecordNum = ProdAdmin.dbo.ProdAdminTracking.RecordNum
LEFT JOIN VendorDataExchange.dbo.StatusInfo_Outgoing
ON ip.InProcessReasonDesc = VendorDataExchange.dbo.StatusInfo_Outgoing.InProce ssReasonDesc
WHERE ip.RecordNum < 2
Any help would be appreciated.