我有下面的SQL查询,我很确定我正在接近它。我想要返回的每个元素都没有属性type.Property,其值为“King”
SELECT DISTINCT o.Object_ID, o.ea_guid as CLASSGUID, o.Object_Type as CLASSTYPE, o.name as Name, type.value as RoomType
FROM ((t_object as o
INNER JOIN t_objectproperties as location
ON o.Object_ID = location.Object_ID)
INNER JOIN t_objectproperties as type
ON o.Object_ID = type.Object_ID)
WHERE location.Property = 'Location'
AND location.Value = 'Queens'
AND type.Property = 'King' IS NULL
答案 0 :(得分:3)
type.Property = 'King'
将始终为true或false,永远不为null,
所以
AND type.Property <> 'King'
可能就是你想要的。