TDengine icon indicating copy to clipboard operation
TDengine copied to clipboard

Please support case when and arithmetic operator in TDengine SQL

Open xiangsf opened this issue 2 years ago • 3 comments

目前的sql语法,过于简陋,在实际的业务场景中,会很容易受到限制。 场景举例: select code ,sum(1) as cnt ,sum(case when side='buy' then 1 end) as buy_cnt ,sum(value1 + value2) as value from trade_log group by code

这个SQL语法非常常见,也非常实用。 目前缺乏这方面的支持,需要自行在程序中做预处理,应用程序的复杂度急剧提升

xiangsf avatar May 03 '22 03:05 xiangsf

请稍等。 我们在后续的版本中会提供 case when 的支持。

hjxilinx avatar May 04 '22 07:05 hjxilinx

Does tdengine support sum(value1 * value2) in SQL at the moment?

0x5487 avatar Jul 03 '22 02:07 0x5487

Does tdengine support case-when sql syntax for v3.0.0?

shymonk avatar Sep 10 '22 17:09 shymonk

3.x has already support case-when

2.x 版本目前官方已经不维护支持了,请迁移升级到最新的 3.x 版本吧。操作手册为:https://www.taosdata.com/tdengine-engineering/17753.html。3.x 和 2.x 相比是全方位更加优越的,关于3.x 的主要特性可以结合这篇文章和官方文档一起了解:https://www.taosdata.com/tdengine-engineering/21550.html

yu285 avatar May 06 '24 05:05 yu285