Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
How to modify relational query strapi

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 (?)'         
} 
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!