简体   繁体   中英

AWS Timestream "Not equal" comparison throws error

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"

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',
   ]);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM