如何将混合表更改为续集?

fnx2tebb  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(282)

我试着用sequelize把table弄乱,但我不知道怎么做。

SELECT count(*) as counts
FROM
  (SELECT * FROM board order by id desc limit 10) as board
WHERE board.login_id = 1234

如何在sequelize中表示这一点

yebdmbv4

yebdmbv41#

你可以在续集里这样做。

//board means your model name

let result = await board.count({
    order: [sequelize.literal('id DESC')],
    limit: 10,
    where: { login_id: 1234 },
    as: 'board'
})

相关问题