How to use the query function from sequelize

Find comprehensive JavaScript sequelize.query code examples handpicked from public code repositorys.

2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
  GROUP BY year_month,sub_products.sub_pro_id
  ORDER By sub_products.sub_pro_id`;
}


const result = await sequelize.query(query, { type: QueryTypes.SELECT });

if(!result.length)
{
  res.status(500).send({
fork icon0
star icon0
watch icon1

+ 3 other calls in file

390
391
392
393
394
395
396
397
398
399
    acquire: dbConfig.pool.acquire,
    idle: dbConfig.pool.idle,
  },
});

const result = await sequelize.query(`Select grn.material_id, raw.material_name, SUM(grn.recv_unit_qty) as purchase,
(SELECT SUM(sale.quantity) FROM mart_order_details sale WHERE sale.material_id = grn.material_id and sale.status != 2 and sale.dept_id = `+deptid+`) as sale from
br_grn_details as grn join raw_materials as raw on raw.material_id = grn.material_id
where grn.status = 1 and grn.dept_id = `+deptid+` and raw.status = 1
group by grn.material_id, raw.material_name
fork icon0
star icon0
watch icon1

+ 3 other calls in file