1
我想要得到與agasID相同的pegawai數量的agamaid這是我的控制器,但是我得到這個錯誤錯誤語法錯誤或訪問衝突 請幫忙我..對不起,我英文不好Laravel錯誤DB :: raw中的語法錯誤或訪問衝突
public function getPropinsi($id)
{
$this->data['query'] = DB::table("propinses")->where("id",$id)->first();
$this->data['title'] = $this->data['query']->Propinsi;
$this->data['count_satker'] = DB::table('satkerfakes')->where('PropinsiID',$id)->count();
$this->data['pegawai'] = Pegawais::where('PropinsiID',$id);
$this->data['agama'] = DB::table("agamas")
->select("agamas.Agama",DB::raw("(select count(*)
from pegawais
where pegawais.PropinsiID = $id
where pegawais.AgamaID = agamas.AgamaID) as total_pegawai"))->get();
return view('index.propinsi',$this->data);
}