3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

InfluxDBでSQLライクにクエリを書く時のTips

Last updated at Posted at 2020-10-28

InfluxDBは,SQLライクな記法で記述できるものの完全なサポートはされていないのでハマったポイントをメモしておく.

like句は使えない

LIKE %hoge%みたいな構文は使えない.かわりに以下を使う.

select "name" from users where "name" =~ /hoge/

否定の場合は以下

select "name" from users where "name" !~ /hoge/

group byとcount()で集計できない

SQLでは項目別の数を数えたい場合は,以下で行えます.

select name,count(*) from users group by name

InfluxDBでこれをやると以下のエラーが出力されます.

mixing aggregate and non-aggregate queries is not supported

これは,アグリゲートクエリと非アグリゲートクエリが混在していることによるエラーです.

参考: https://community.influxdata.com/t/err-mixing-aggregate-and-non-aggregate-queries-is-not-supported/10508

inner joinやouter joinがない

以下に対処方法が書かれている.

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?