Postgresql – POSTGRES ORDER BY random() with ROW_NUMBER not working as expected
let data = await Category.findAll({ where: { list_category_id: body.category_id }, attributes: { include: [ [ sequelize.literal(`COALESCE ( CASE WHEN youtube_id_id IS NOT NULL THEN ROW_NUMBER() OVER (ORDER BY random(), youtube_id_id) END, CASE WHEN instagram_id_id IS NOT NULL THEN ROW_NUMBER() OVER…