I am having a hard time doing a 'INSERT INTO' with 2 sub queries in the WHERE clause. I'm not sure wht I'm missing, it keep stating that an expression of non-boolean type specified in context where a condition is expected, near ';'.
This is my attempt at it:
INSERT INTO [Monitor].[dbo].[MonitorIncidents]
SELECT *
FROM dbo.MonitorSource
WHERE (
SELECT DISTINCT *
FROM Lookup.dbo.ServerInfo S
WHERE NOT EXISTS
(
SELECT 1
FROM Lookup.dbo.Facts F
WHERE F.FactsName = S.SrvName
AND W.DateTime > DATEADD(hour, -23, CURRENT_TIMESTAMP)
)
)
Your WHERE
clause is missing an operand like =
, <
, >
, etc. You are just returning a field to WHERE
wihout a comparison. Depending on what you want to do, extend your WHERE
to include a comparison.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.