gpt4 book ai didi

javascript - Order By (alias) then Order by second sequelize

转载 作者:行者123 更新时间:2023-12-03 22:37:52 29 4
gpt4 key购买 nike

我正在使用 sequelize.js,我在使用 order 语句时遇到问题,我想先通过 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

最佳答案

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

关于javascript - Order By (alias) then Order by second sequelize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55972470/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com