我一直在尝试使该API正常工作。我可以成功地传递companyID的值,但是相同的方法不适用于dateID。
我尝试将两者声明为:
var dateID = 20190610;
var dateID = "20190610";
在查询中,我同时尝试了两种方法:
'${dateID}'
${dateID}
我尝试过上述4的组合。如果直接在查询中传递了20190610,它将起作用。任何输入将不胜感激。
app.post("/abcd",(req,res) => {
console.log("test");
var companyID = "56210";
var dateID = 20190610;
redshiftClient.connect(function (err) {
redshiftClient.query(
"select company_id as COMPANY,user_id as username,label as Associate,original_timestamp as Login_Time from sample.account_operation where company_id in ('${companyID}') and label like 'login' and DATE(original_timestamp)>= ('${dateID}') and user_id not like '%@sample%'",function (err,data) {
if (err) throw err;
else {
console.log(data);
redshiftClient.close();
}
}
);
});
});