I get this error when I run the query. The task name is "Migrate to LDCSA Connection - Remote Automotive" and I have remove the AppsSuite line as it does not pertain to what I am searching for.
Msg 156, Level 15, State 1, Line 20
Incorrect syntax near the keyword 'INNER'.
My SQL is:
use LANDesk
go
Select A0.Displayname as "Computer Name",CONVERT(varchar, CAST(InstallDate as DATE), 101) as "Install Date", CONVERT(varchar, LastUpdInvSvr, 101) as "Last Inventory Update",
'Task Status' = Case
WHEN A2.MAC_STATUS = '0' THEN 'Waiting'
WHEN A2.MAC_STATUS = '2' THEN 'Done'
WHEN A2.MAC_STATUS = '3' THEN 'Failed'
WHEN A2.MAC_STATUS = '7' THEN 'Off'
WHEN A2.MAC_STATUS = '8' THEN 'Canceled'
WHEN A2.MAC_STATUS = '10' THEN 'Delayed'
WHEN A2.MAC_STATUS = '11' THEN 'Unknown Status Code'
END
from Computer A0
LEFT OUTER JOIN LD_TASK_MACHINE A2 ON A0.Computer_Idn = A2.COMPUTER_IDN
LEFT OUTER JOIN LD_TASK A1 ON A1.LD_TASK_IDN = A2.LD_TASK_IDN
LEFT OUTER JOIN TCP A3 ON A0.Computer_Idn = A3.Computer_Idn
LEFT OUTER JOIN AppSoftwareSuites A4 ON A0.Computer_Idn = A4.Computer_Idn
LEFT OUTER JOIN LanDesk A5 (nolock) ON A0.Computer_Idn = A5.Computer_Idn
WHERE A1.TASK_NAME = 'Migrate to LDCSA Connection - Remote Automotive'
order by [Task Status], [Last Inventory Update]
INNER JOIN LD_TASK ON ConsoleUser.ConsoleUser_Idn = LD_TASK.CONSOLEUSER_IDN
INNER JOIN DeliveryMethod ON LD_TASK.DELIVERYMETHOD_IDN = DeliveryMethod.DeliveryMethod_Idn
INNER JOIN PACKAGE ON LD_TASK.PACKAGE_IDN = PACKAGE.PACKAGE_IDN
ORDER BY ConsoleUser.UserName