SQLite 'year', 'month' error Hi,
I have the next method, and it works fine with MySQL, but not with SQLite (when I run my tests). Looks like the root of the problem in 'year' and 'month' in SQLite.
return static::selectRaw('year(created_at) year, monthname(created_at) month, count(*) published')
->groupBy('year', 'month')
->orderByRaw('min(created_at) desc')
->get()
->toArray();
So, should I rewrite this code in some way, or... Actually, I'm not sure about the best solution.
Thank you for any help!
return static::selectRaw('year('created_at') year, monthname('created_at') month, count(*) published')
->groupBy('year', 'month')
->orderByRaw('min(created_at) desc')
->get()
->toArray();
I don't know what you're tryiing to achieve, but this is a little bit more proper.
@tomasosho I'm trying to create an Archive block, like this:
Archive
December 2019
November 2019
Please sign in or create an account to participate in this conversation.