1
私のアプリケーションには次のSQLクエリがあります。laravel MySQLクエリの最適化
$defaultGoal = DB::table("goals")
-> where("activitiesID", "=", $this->activityID)
-> where("usersID", "=", $userID)
-> pluck("goal");
$defaultGoalPoints = DB::table("goals")
-> where("activitiesID", "=", $this->activityID)
-> where("usersID", "=", $userID)
-> pluck("goalpoints");
$defaultPoints = DB::table("goals")
-> where("activitiesID", "=", $this->activityID)
-> where("usersID", "=", $userID)
-> pluck("points");
各クエリは配列を返します。これらのクエリをすべて組み合わせて、$defaultPoints
、$defaultGoalPoints
、および$defaultGoal
の同じ配列を返す方法はありますか?
...それがお役に立てば幸い - > get()を使ってエントリ全体を取得し、PHPを使って必要なデータを配列に引き出しますか? (Laravelはこれを行う短い方法を持っているかもしれません、そして、もし私が知っていれば、他の人に話すことを許可します)。 – Atlas