0
我有laravel web應用程序,並用sqlite數據庫在離子框架中實現它。如何查詢關係數據庫。結合兩個相關的sqlite查詢
例如,(根據laravel調試) subjects->belongsToMany->students
在這個關係,laravel運行兩個查詢
1. select * from "subjects" where "subjects"."deleted_at"
2. select "students".*, "student_subject"."subject_id" as "pivot_subject_id", "student_subject"."student_id" as "pivot_student_id" from "students" inner join "student_subject" on "students"."id" = "student_subject"."student_id" where "students"."deleted_at" is null and "student_subject"."subject_id" in (1,2,3,4).
這些queires返回
subjects = [['id':1, 'name': 'physic', students"[{id:1, name:John}, {id:2,name:Raney}]},['id':2, 'name': 'math', students"[{id:3, name:Paul}, {id:4,name:Sonar}]}]
我可以將兩個查詢到嗎?或者如何在離子框架中選擇這種類型?