0
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 5 years have passed since last update.

redashのグラフ化でハマる

Posted at

現象

redashを使って、下記のsqlである数を日毎に集計した折れ線グラフを作ろうとしたら、なぜかグラフがうまく作れませんでした。

SELECT date_format(datetime, '%y/%m/%d') AS date,
       count(id) AS count
FROM sample
GROUP BY date;

解決

日付のフォーマットの%y/%m/%d%y-%m-%dに修正したらきちんとグラフ化されました:clap:
mysqlの日付の形式が'2015-07-21'、'20150721'、20150721のようにしないと日付として認識されないからでしたー
日付リテラルと時間リテラル

SELECT date_format(datetime, '%y-%m-%d') AS date,
       count(id) AS count
FROM sample
GROUP BY date;
0
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
0
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?