Laravel 组\u concat-查询生成器

Laravel 组\u concat-查询生成器,laravel,query-builder,Laravel,Query Builder,这是我的SQL操作: select `id_ifc_espaces`,GROUP_CONCAT(DISTINCT `nom_espace`) as nom_espace ,GROUP_CONCAT(DISTINCT `fonction_espace`) as fonction_espace, GROUP_CONCAT(DISTINCT `id_ouvrage_slab_wall`) as id_ouvrage_slab_wall , GROUP_CONCAT(DISTINCT `type_l

这是我的SQL操作:

select `id_ifc_espaces`,GROUP_CONCAT(DISTINCT `nom_espace`) as   nom_espace ,GROUP_CONCAT(DISTINCT `fonction_espace`) as fonction_espace, GROUP_CONCAT(DISTINCT `id_ouvrage_slab_wall`) as id_ouvrage_slab_wall , GROUP_CONCAT(DISTINCT `type_limit`) as type_limit,GROUP_CONCAT(DISTINCT `type_ouvr`) as type_ouvr from `relespouv` group by`id_ifc_espaces` 
这是我尝试的查询生成器:

$relations = DB::table('relespouv')
->select('id_ifc_espaces')
->group_by('id_ifc_espaces')
->where('id_mn','=',$idmn)
->get(array(DB::raw('GROUP_CONCAT(DISTINCT nom_espace) as   nom_espace,
                     GROUP_CONCAT(DISTINCT fonction_espace) AS fonction_espace,
                     GROUP_CONCAT(DISTINCT id_ouvrage_slab_wall) AS id_ouvrage_slab_wall,
                     GROUP_CONCAT(DISTINCT type_limit) AS type_limit, 
                     GROUP_CONCAT(DISTINCT type_ouvr) AS type_ouvr ')));
当我尝试使用例如
nom\u espace
时:

 $relespouv[$allelement['Relation']][12]=$relation->nom_espace;
我得到一个错误:

未定义的属性:stdClass::$nom_espace

谁能帮我一下吗?

你应该走了

array(DB::raw('GROUP_CONCAT(独特的名称空间))作为名称空间,
集团公司(独立基金会)作为基金会,
组混凝土(不同的id板墙)作为id板墙,
组_CONCAT(不同类型_限制)作为类型_限制,
组_CONCAT(不同类型_ouvr)作为类型_ouvr')
)
像这样从
get()
select()

$relations=DB::table('relepoov')
->选择(数组)(
“id_ifc_espaces”
DB::raw('GROUP_CONCAT(独立名称空间)作为名称空间,
集团公司(独立基金会)作为基金会,
组混凝土(不同的id板墙)作为id板墙,
组_CONCAT(不同类型_限制)作为类型_限制,
组_CONCAT(不同类型_ouvr)作为类型_ouvr')
))
->分组人('id\U ifc\U espaces')
->其中('id_mn','=',$idmn)
->get();

@YOSRABENSALAH很乐意帮忙,如果有帮助,你可以接受我的回答:)