Hello. I Hope To Write SQL Like This: ------------------------------------------- SELECT DATE_FORMAT(created_at, '%Y-%m-%d') AS date, COUNT(*) FROM tbl_xxx GROUP BY (DATE_FORMAT(created_at, '%Y-%m-%d')); -------------------------------------------
Can I Build By ORM Query? I Tried, But Not Work...
One, It's Seems Way To Most Simple Is Using "\DB::expr()", But Not Work. Next, I Passed Subquery To "->select()" method, But...Oh...
DB::expr() can not be used with ORM queries in a select(), only in where().
The ORM is not a query builder, use a normal DB. ORM can't produce that group_by either, and because the result doesn't include the primary key, it will also not be able to hydrate the result back into ORM objects.