企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
>[danger] 指定查询的字段并设置别名 ~~~ DB::table('users')->select('username as name', 'id')->get(); ~~~ >[danger] 给已经构建好的查询添加更多字段 ~~~ $base = DB::table('users') ->select('username as name', 'id'); $data = $base->addSelect('password')->get(); ~~~ >[danger] 内部原生表达式 ~~~ $data = DB::table('users') ->select(DB::raw('concat("id", "username")')) ->groupBy('password') ->get(); ~~~ ~~~ $data = DB::table('users') ->selectRaw('count(*) as count') ->groupBy('password') ->havingRaw('count > 1') ->get(); ~~~