$search_alls=
DB::table('a16s as A')
->select('A.id')
// ->select('A.*')
->addSelect(DB::raw('SUM(CASE WHEN B.approve = 1 ELSE 0 END) as Yshow'))
->leftjoin('a16s_likes as B', function($join) {
$join->on('A.id', '=', 'B.p_id');
})
->groupBy('A.id')
->get();
when I use above select('A.id') is work well.
But when I use select('A.*') to select all A cloumn
I got the error
SQLSTATE[42000]: Syntax error or access violation: 1055 'employee.A.name' isn't in GROUP BY
PS:employee is my DB name
The column on A table is
id name ....
1 john
2 mary
3 susan
How can I select all column by the leftjoin?
the column A.id is one to many relationship to the B.p_id column.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…