Search code examples
c#uwpazure-sql-databaseazure-mobile-servicesmobileserviceclient

How to get column average from azure mobile apps


I am using azure mobile apps .net back-end for my windows 10 application and I would like to retrieve the column average from a table in my database. How can I do that? I have searched the internet and can't find anything useful.

My Table just has two columns; id (string) and Rating(int).


Solution

  • There are a couple of ways.

    1) Do a LINQ query against an offline version of the data. This will calculate the average on the client

    2) Do a LINQ query against the online version of the data. This will calculate the average on the client, but pull all the data from the server, which may be less than desirable.

    3) Implement a Custom API that returns the average. This will calculate the average on the server, and allow you to do some caching of the average for quicker access.