Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda