A simple query:
var viewModel = {
dataSource: Application_with_Chart.db.nom_clasa_articole.toDataSource({
select: ["id","product", "quantity"]
})
};
return viewModel;
in SQL:
SELECT id,product,quantity
FROM nom_clasa_articole
This is simple, but I need a query with group by and sum:
SELECT id, product, SUM(quantity)
FROM nom_clasa_articole
GROUP BY product
How can I write this query in devexpress?
If I am not mistaken, the question is about DevExtreme Multi-channel applications. They use OData services.
OData prodocol does not have direct equivalent to SQL
GROUP BY
. You have two options here:Use OData service operations for grouping on the server side.
Perform grouping on the client in a
postProcess
handler as shown below.Client-side grouping: