我想在数据库中获取数组,它在数据库查询中工作(我的数据库我使用 postgrest)但在我的项目 laravel 中不起作用。错误消息 -> 未定义列:7 错误:列 sample1.text[1] 不存在
table sample1
___________________________________
| id | name | text[] |
|------+------+--------------------|
| 1 | aa | {xxx1,xxx2,xxx3} |
| 2 | bb | {xxx1,xxx2,xxx3} |
| 3 | cc | {xxx1,xxx2,xxx3} |
|______|______|____________________|
我需要价值
{
xxx1,
xxx1,
xxx1
}
我的代码
$search = DB::table("sample1")->select(array( 'sample1.text[1]'))->get();
return response()->json($search);
在我的数据库查询中它工作
SELECT "NSO_STAT_GIS"."BND_SET_STAT_TABLE"."MAPTB_CAT_SL_ID"[1] FROM "NSO_STAT_GIS"."BND_SET_STAT_TABLE"