System Information
- Strapi Version:
- Operating System:
- Database:
- Node Version:
- NPM Version:
- Yarn Version:
Hi sorry my english is not so good. but i hope your understand.
i have question about modify query in relational db.
for example i have class table and student table. and relation class has many student. in each table i have a ‘status’ field.
in standard strapi, it will fine. and will return like this
{
"id": 1,
"class_name": "A",
"students": [{
"id": 1,
"name": "John Doe",
"status": "active"
},
{
"id": 2,
"name": "Thomas A",
"status": "inactive"
}
]
}
but how to get class with status “active” student?
and will return like this
{
"id": 1,
"class_name": "A",
"students": [{
"id": 1,
"name": "John Doe",
"status": "active"
}
]
}
FYI: when i run in debug query. standard strapi will reproduce query like this.
{
method: 'select',
options: {},
timeout: false,
cancelOnTimeout: false,
bindings: [ '1', 1 ],
__knexQueryUid: 'wo9_-ifCsMpUwrldEeoFF',
sql: 'select "class".* from "class" where "class"."id" = ? limit ?'
}
{
method: 'select',
options: {},
timeout: false,
cancelOnTimeout: false,
bindings: [ 1 ],
__knexQueryUid: 'MqjWNmw_Ze4w4f4B8CyrM',
sql: 'select distinct "student".* from "student" where "student"."class_id" in (?)'
}