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

394
Views
obteniendo un error de sintaxis mysql al usar parámetros en la consulta mysql

Obtener error de sintaxis sql en nodejs

Estoy usando este código:

 async function getNotificationFsql(data) { var query = "select * from notifications where id>${data.start} and receiver=${data.recId} limit 10"; var record = await db.sequelize.query(query , function (err,results) { if (err) { console.log('Error while getting data from MYSQL :- ' + err); } else { console.log('Notifications data which we got from MYSQL :- ' + results); } } ); // console.log(record); console.log('Notifications :- ' + record[0]); return record[0]; };

Y obtuve:

código: 'ER_PARSE_ERROR', errno: 1064, sqlState: '42000',

sqlMessage: "Tiene un error en su sintaxis SQL; consulte el manual que corresponde a la versión de su servidor MySQL para conocer la sintaxis correcta para usar cerca de '{data.start} and receiver=${data.recId} limit 10' at line 1 ",

sql: 'seleccione * de notificaciones donde id>${data.start} y receptor=${data.recId} límite 10', parámetros: undefined }, sql: 'seleccione * de notificaciones donde id>${data.start} y receptor=${data.recId} límite 10', parámetros: indefinido

¿Qué estoy haciendo mal?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

lo siento, estoy haciendo esto mal

Resuelvo este error haciendo esto:

 var query = "select * from notifications where id>"+data.start+" and receiver="+data.recId+" limit 10";
about 4 years ago · Juan Pablo Isaza Report
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!