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

741
Views
TypeORM, createQueryBuilder con CAST y AS, ¿alguna opción?

Estoy usando TypeORM con Nestjs, y después de consultar documentos sobre TypeORM y github repo , no puedo encontrar ningún ejemplo o respuesta a mi problema.

Tengo la siguiente consulta:

 SELECT * FROM ( SELECT *, SUM(CAST("amountA" AS DECIMAL)) OVER (ORDER BY CAST("priceA" AS DECIMAL) ASC, id) AS quantity_amount FROM public."order" WHERE item_a_id= 1 AND item_b_id = 4 AND CAST("priceA" AS DECIMAL) <= CAST('92481' AS DECIMAL) ORDER BY "priceA" ASC ) AS c WHERE c.quantity_amount <= CAST('100000' AS DECIMAL);

Como puede ver, convierte algunos campos varchar de cadenas a decimales porque estoy tratando con BigNumber y no estoy usando decimals en Entity.

Y también tengo esta parte, con AS c que se usa más adelante. Entonces mi pregunta es:

¿Puedo usar createQueryBuilder de TypeORM y cómo debo pasar exactamente una cadena como: AND CAST("priceA" AS DECIMAL) <= CAST('92481' AS DECIMAL) y AS c y el campo quantity_amount de mi subconsulta?

¿Hay alguna otra opción? Porque por ahora, estoy tratando con SQL simple y un método de query en lugar de createQueryBuilder .

over 4 years ago · Santiago Trujillo
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!