I am trying to use PartiQL with DynamoDB to perform SQL queries to check if a device is inactive and contains an error. Here's is the query I am using:
SELECT * 
FROM "table" 
WHERE "device"."active" = 0 AND "device"."error" IS NOT NULL
However I've noticed that even if a device doesn't have the error item, the query still returns a row. How can I query a device that only contains the error item?
With error item
{
    "id": "value",
    "name": "value,
    "device": {
        "active": 0,
        "error": {
            "reason": "value"
        }
    }
}
Without error item
{
    "id": "value",
    "name": "value,
    "device": {
        "active": 0
    }
}