'How to sort result by owner ID SQL, Seqelize?

Please note the below contents:

  1. user table
  2. where condition 1

1 USER TABLE

id owneeId  delete shop

1   12       1       1
2   13       1       1
3   7        1       1
4   7        1       1

2 Where condition 1 of sequelize :

const result = await findAllusers({
        where: {
            [Op.or]: [{
                owner_id: {
                    [Op.in]: rows.map(['12','13']),
                }
            }, {
                owner_id: {
                    [Op.notIn]: rows.map(['12','13']),
                },
             shop: 1
            }]
        }

Desired Result :

I need result as :

result =   [{id:1,ownerid:7,delete:1,shop:1},
{id:2,ownerid:7,delete:1,shop:1},
{id:3,ownerid:12,delete:1,shop:1},
{id:4,ownerid:13,delete:1,shop:1}]

the ownerid 7 peoples first ... then all other users.. but I am now getting result not sorted like that, and sometimes I am getting ownerid 7 perosna as last elements.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source