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

182
Views
How to use a string in place of a MySQL query placeholder?

The following query returns productSum as null:

var productName = "productTwo"
db.query("SELECT sum(?) as productSum FROM orders WHERE email = ? AND productTwoName = ?",
[productName, email, productNamesArray[i]],

But replacing sum(?) with sum(productTwo) & removing productName gives the desired sum result.

How can I query using a variable value instead of manually including the name in the query?

about 4 years ago · Santiago Gelvez
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!