sql groupby not working, I want to group by code_branch
P粉021553460
P粉021553460 2024-04-06 19:24:49
0
2
444

->select
(
  'a.status as status',
  'b.name as customer_name', 
  'e.name as branch_name' , 
  'c.name as company_name',
  'd.name as project_name',
  'f.name as region_name',
  'e.code as branch_code',
  'e.id as branch_code',
  DB::raw('COUNT(a.id) as total_transaksi')
)
->groupBy
(
  'e.id',
  'b.name',
  'e.name', 
  'e.code',
  'a.status',
  'c.name',
  'd.name',
  'f.name'
)

P粉021553460
P粉021553460

reply all(2)
P粉428986744

Go to config/database.php

Strictly set to false

P粉154798196

This is incorrect, you cannot use a single name for the same column,

'e.code as branch_code',
  'e.id as branch_code',

change to

'e.code as branch_code',
  'e.id as branch_id',
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!