AWS Timestream "Not equal" comparison throws error

339 Views Asked by At

I have a query where I want to fetch all data where "completed" field is not equal to 0, but it throws an error. I dont get it why as their documentation supports these comparisons.

$result = $query_client->query([
    'MaxRows' => 1,
    'QueryString' => 'SELECT field1, field2, completed, date 
FROM "db"."table"
WHERE completed != 0  // Tried as "0" as well, doesnt work
ORDER BY date DESC',
]);

Error:

com.amazonaws.timestream.v20181101.query#ValidationException, '<>' cannot be applied to varchar, integer"

1

There are 1 best solutions below

1
On BEST ANSWER

Fixed it like this:

   $result = $query_client->query([
     'MaxRows' => 1,
     'QueryString' => 'SELECT field1, field2, completed, date 
      FROM \"db\".\"table\"
      WHERE completed =  '" . 0 . "'
      ORDER BY date DESC',
   ]);