我如何在续集中这样做?

时间:2017-01-12 06:07:01

标签: node.js sequelize.js

SELECT client_name,mid_number,user_name,PASSWORD 
FROM automation_run_log 
WHERE LENGTH(schedule_status="FAILED") > 0 
GROUP BY client_name

我的代码:

automationRunLog.findAll({
    attributes : ["clientName","midNumber","userName","password"],
    where      : sequelize.where(sequelize.fn('length',      sequelize.col('schedule_status')),"FAILED"),
    group      : ['clientName']
    }).then(function (clientDtls) {
    console.log(clientDtls)
})

我在哪里提供$gt:0 where where子句?

1 个答案:

答案 0 :(得分:0)

我没有时间尝试,但这应该有效:

automationRunLog.findAll({
  attributes : ["clientName","midNumber","userName","password"],
  where      : sequelize.where(sequelize.fn('length', 
               sequelize.col('schedule_status')),"FAILED", {$gt: 0}),
  group      : ['clientName']
}).then(function (clientDtls) {
  console.log(clientDtls)
})
相关问题