oc-news icon indicating copy to clipboard operation
oc-news copied to clipboard

Statistics not showing

Open helmutkaufmann opened this issue 4 years ago • 2 comments

/backend/indikator/news/statistics cannot be found, the error is is

SQLSTATE[HY000]: General error: 1 no such function: YEAR (SQL: select count(id) as c, YEAR(queued_at) as y, MONTH(queued_at) as m from "indikator_news_newsletter_logs" group by YEAR(queued_at), MONTH(queued_at) order by "y" asc, "m" asc)

Is it possible that I get this as I use an SQLITE database as opposed to the standard MYSQL?

helmutkaufmann avatar Oct 08 '20 10:10 helmutkaufmann

It is possible.

gergo85 avatar Oct 08 '20 12:10 gergo85

SQLite does not have a YEAR nor MONTH function. Instead use strftime('%Y', queued_at), unfortunately this is not compatible with other SQL databases.

Might it be possible to rewrite this query with eloquent?

TimFoerster avatar Oct 08 '20 12:10 TimFoerster