Support the ongoing development of Laravel.io →
posted 6 years ago
Last updated 1 year ago.
0

sometimes you may need to use a raw expression in a query. To create a raw expression, you may use the DB::raw method:

$users = DB::table('users') ->select(DB::raw('count(*) as user_count, status')) ->where('status', '<>', 1) ->groupBy('status') ->get();

By:Xtreem Solution

Highly Skilled Laravel Developer

Dedicated PHP Developer

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.