join条件如果是find_in_set, laravel的查询构造器应该怎么写
我的sql是这样:
select g.Fid, g.Fname, g.Fstatus,g.Frules, group_concat(a.Fname) as active from t_auth_group g inner join t_auth_active a on find_in_set(a.Fid, g.Frules)
join的条件是find_in_set,这种情况构造器应该怎么写?
谢谢
1 Comment
可以使用闭包: $query ->selectRaw('apartment.id,sum(average_cost) as average_cost_sum,apartment_indirect_cost.apartment_cost_date,apartment.apartment_list_name') ->leftJoin('apartment_indirect_cost',function($join){ $join->whereRaw("find_in_set(apartment_indirect_cost.apartment_table_id,apartment.apartment_parent_table_id)"); })