Skip to content

Instantly share code, notes, and snippets.

@Faizanq
Created January 20, 2019 16:51
Show Gist options
  • Save Faizanq/6a749da032fb6cf7166f49bdef7d1f28 to your computer and use it in GitHub Desktop.
Save Faizanq/6a749da032fb6cf7166f49bdef7d1f28 to your computer and use it in GitHub Desktop.
models.inventory_transaction.findAll(
{ attributes: [[models.sequelize.fn('sum', models.sequelize.col('quantity')), 'total']],
include : [
{
model : models.product_entry,
attributes: [],
include : [
{
model : models.product,
attributes: [['name', 'name']]
}
]
}
],
group : ['inventory_transaction.product_entry_id', 'inventory_transaction.created_date', 'name' ]
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment