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

181
Vistas
SQL filter related name using javascript

What I did so far is I created a query to get all Authors, and I created a query for getting all published book by authors, my problem is that I cant filter what author published book on transaction. What i want is to count all author published book on transaction

This is my code

const getAuthors = async ()=>{
    return new Promise((resolve, reject)=>{
        var author = (`SELECT id, name FROM Author`, 1000, data=>{
            let obj = { authorsId: [] }
            for(let x = 0; x < data.length; x++){
                obj.authorsId.push(data[x][0]);
            }
            console.log(obj)
            return resolve(obj);
        })
    })
}

result of console.log(obj)

{
    "authorsId": [
        1,
        2,
        3,
        4
    ]
}

/

const getAuthorPublished = async ()=>{
  const authorsId = await getAuthors()
  return new Promise((resolve, reject)=>{
        var bookpublished = (`SELECT exp_fAuthor, rAuthors, exp_fAuthor_Published_Book FROM KTMS_Transaction`, 1000, data=>{
          let arrAuthorPublished = { authors: [], authorIds: [], counts: [] }
            for(let x = 0; x < data.length; x++){
                arrAuthorPublished.authors.push(data[x][0]);
                arrAuthorPublished.authorIds.push(data[x][1]);
                arrAuthorPublished.counts.push(data[x][2]);
            }
          console.log("arrAuthorPublished: ", arrAuthorPublished)
            return resolve(arrAuthorPublished);
        })
    })
}

//result of console.log(arrAuthorPublished)

{
    "authors": [
        "Claire",
        "Claire",
        "Yuno",
        "Claire"
    ],
    "authorIds": [
        440944522,
        440944522,
        440930072,
        440944522
    ],
    "counts": [
        1,
        1,
        1,
        1
    ]
}
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