'TDengine - invalid operation

I was trying to execute sql:

select last(*) from mytable where index=index-1

Describe mytable:

             Field              |         Type         |   Length    |   Note   |
=================================================================================
 ts                             | TIMESTAMP            |           8 |          |
 gauge                          | DOUBLE               |           8 |          |
 index                          | NCHAR                |          11 | TAG      |

The result occur error:

Invalid operation


Solution 1:[1]

index is nchar type so you should change the SQL to

select last(*) from mytable where index='some_value';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zhaoyanggh