我按照以下方式运行查询: -
unack_query = """
SELECT aa.AlertObjectID,
aa.TriggeredMessage,
aa.Acknowledged,
aa.AcknowledgedBy,
aa.TriggeredDateTime,
ao.EntityType,
ao.EntityCaption,
node.Caption,
node.CustomProperties.DeviceOwner
FROM Orion.AlertActive aa
INNER JOIN Orion.AlertObjects ao
ON aa.AlertObjectID = ao.AlertObjectID
LEFT JOIN Orion.Nodes node
ON ao.RelatedNodeId = NodeID
WHERE node.CustomProperties.DeviceOwner = 'Network Team' AND aa.Acknowledged = False
ORDER BY aa.TriggeredDateTime DESC
"""
此查询返回零结果。但是,当我从查询中删除“AND aa.Acknowledged = False”时,它可以工作。我还可以在结果中看到Acknowledged字段是一个布尔值。任何人都可以指出我为什么会失败的正确方向?
由于
答案 0 :(得分:1)
尝试检查AND aa.Acknowledged = TRUE
是否适用于您没有条件的情况..(可能您没有错误值)
或者可能是'False'作为字符串
WHERE node.CustomProperties.DeviceOwner = 'Network Team' AND aa.Acknowledged = 'False'
或者你没有价值所以你也应该检查
WHERE node.CustomProperties.DeviceOwner = 'Network Team' AND aa.Acknowledged is null