我想使用laravel查询构建器根据参加比赛的国家进行计算。
Table country:
------------------
country_id
country_name
Table company:
-----------------
company_id
company_name
country_id(fk)
Table_participate_company:
-------------------------
company_id
competition_id
Table competition:
--------------------
competition_id
competition_name
示例输出:
$total = DB::table('company')
->join('participate_company', 'company.company_id', '=','participate_company.company_id')
->join('country', 'company.country_id', '=','country.country_id')
->get();