0

I encountered an error when executing the sql statement as follows in TDengine.

select task_name, group_concat(tbname, ',') as job
from (select * from meters where ts >= '2022-11-03 10:10:00' and tenant_name = 'xxx') 
partition by ts 
group by task_name having max(cpu) > 100;

Error report:

DB error: Invalid tbname pseudo column

I googled the error information, but get nothing valuable message. Is there any syntax error in my statement?

JamesLiu
  • 1
  • 2

1 Answers1

0

It looks like the problem is caused by a nested query. You can create an alias for tbname in the subquery and then use the alias outside.

You can try this:

select task_name, group_concat(tb, ',') as job
from (select tbname tb, * from meters where ts >= '2022-11-03 10:10:00' and tenant_name = 'xxx') 
partition by ts 
group by task_name having max(cpu) > 100;
cpvmrd
  • 51
  • 4