Example:
´´´
$orders = DB::table("orders")->select(DB::raw(created_at as date) as stat_day, SUM (billing_totalprice) GROUP BY (created_at as date) order by stat_day));
$orders = DB::table("orders")->select(DB::raw("created_at as stat_day, SUM(billing_totalprice) GROUP BY created_at order by created_at"));
Also, your query is a bit weird. Everything points to the created_at column and you only rename them in your query but you don't do anything with it...
Something is wrong, i dd $orders, this is a resut:
+columns: array:1 [▼
0 => Illuminate\Database\Query\Expression {#322 ▼
#value: "created_at as stat_day, SUM(billing_totalprice) GROUP BY created_at order by created_at"
}
]
1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP BY created_at order by created_at from orders' at line 1 (SQL: select created_at as stat_day, SUM(billing_totalprice) GROUP BY created_at order by created_at from orders)