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

289
Vistas
mysql json_extract dynamic position
SELECT id, JSON_EXTRACT(column,'$.parent[3].child') AS child FROM table 
WHERE JSON_EXTRACT(column,'$.parent[3].child') IN (1)

this is my sql query. i have a also column jsonlength how can i connect this 2 columns in one query ? i want to change 3 to dynamic number given in jsonlength

for example:

SELECT id, JSON_EXTRACT(column,'$.parent['jsonlength'].child') AS child FROM table 
WHERE JSON_EXTRACT(column,'$.parent['jsonlength'].child') IN (1)

but this query not working.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You need to form the JSON path with string concatenation. In MySQL, this is done with the CONCAT() function.

SELECT id, JSON_EXTRACT(column, CONCAT('$.parent[',jsonlength,'].child')) AS child FROM table 
WHERE JSON_EXTRACT(column,CONCAT('$.parent[',jsonlength,'].child')) IN (1)
over 4 years ago · Santiago Trujillo Denunciar
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