Zeeshan Nisar
Zeeshan Nisar

Reputation: 77

Group by database query in laravel not working

I am new to Laravel.

I have a database table named A and column names are 1,2,3 .

In column 3 i have different values like a,b,c. Now what i want is to print out the total no of values of a,b and c using group by clause. Sorry for my bad English. Thanks in advance.

i am doing it like

$cot=DB::table('A')->group By('3')->count();

    echo $cot;

Upvotes: 2

Views: 59

Answers (1)

Matt Stephens
Matt Stephens

Reputation: 922

There seems to be a space in the query.

It should look like the below.

$cot = DB::table('A')->groupBy('3')->count();

echo $cot;

Upvotes: 1

Related Questions