按(别名)排序,然后按第二次sequalize

时间:2019-05-03 15:01:49

标签: javascript node.js database sequelize.js psql

我正在使用sequalize.js,我在处理订单语句时遇到麻烦,我想先通过if id(如果我的id在该别名表中)进行订购,然后再进行另一订购。...

order = [['alias', 'id'], /*[this order statement already works]*/]
include = [    
      {
          model: model.aliasTable,
          as: 'alias'
      }
]
//['alias', 'id'] this is what is not working in my order statement

1 个答案:

答案 0 :(得分:0)

尝试order: [['alias', 'DESC'], ['id', 'DESC']]