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

246
Views
INNER JOIN en una matriz de ID que devuelve una matriz de objetos mediante el uso de una consulta sin formato de secuencia en node.js

Tengo datos en el siguiente formato.

 { "userId": 1 "stateId": 199, "productId": [ 1, 2 ] }

Quiero obtener este tipo de respuesta mediante el uso de una consulta sin procesar secuencial, puedo obtener una respuesta para el ID de usuario y el ID de estado mediante la unión interna,

 const List = await db.sequelize.query( 'SELECT `user`.`id` AS `user.id`,`user`.`role` AS `user.role`,`user`.`name` AS `user.name`,`state`.`stateId` AS `state.stateId`,`state`.`stateName` AS `state.stateName`,state`.`Specialization` AS `state.Specialization` FROM details,INNER JOIN user ON `user`.`userId`=details.userId INNER JOIN state ON `state`.`stateId`=details.stateId WHERE ORDER BY ASC LIMIT :offset, :limit', { nest: true, mapToModel: true, replacements: { limit: limit, offset: offset } }); }

pero no puede obtenerlo para un producto de una matriz de ID.

 { "user": { "id": 1, "role": "USER", "name": "user1" }, "state": { "stateId": 199, "stateName": "test", "Specialization": null }, "products": [ { "productId": 1, "productName": "Test product 1" }, { "productId": 2, "productName": "Test product 2" } ] }
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!