Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js SequelizeJs:按术语排序_Node.js_Sqlite_Orm_Sql Order By_Sequelize.js - Fatal编程技术网

Node.js SequelizeJs:按术语排序

Node.js SequelizeJs:按术语排序,node.js,sqlite,orm,sql-order-by,sequelize.js,Node.js,Sqlite,Orm,Sql Order By,Sequelize.js,我在nodejs中使用SQLite。我尝试获取一个sql语句,如: SELECT id, description, created_at, postponed, done_at FROM tasks WHERE done_at IS NULL ORDER by (id+postponed),postponed,id ASC LIMIT 1 问题在于OREDR BY 我试过这个: Task.find({ where: ["done_at is not n

我在nodejs中使用SQLite。我尝试获取一个sql语句,如:

 SELECT
  id,
  description,
  created_at,
  postponed,
  done_at
FROM tasks
WHERE done_at IS NULL
ORDER by (id+postponed),postponed,id ASC
LIMIT 1
问题在于
OREDR BY
我试过这个:

Task.find({
          where: ["done_at is not null"],
          order: [["(id+postponed)", "ASC"], ["postponed", "ASC"], ["id", "ASC"]],
          limit: 1
        }).then(...)
但是查询变成:
orderbytask.(task\u id+delayed)ASC,task.delayed ASC,task.task\u id ASC


有人知道如何解决这个问题吗?

我自己找到了一个解决方案:

Task.find({
    where: ["done_at is not null"],
    order: '(id+postponed),postponed,id ASC',
    limit: 1
}).then(...)
这并不完美,但对我来说很管用