Azure Sql Database: how to perform calculations on the data I'm querying

Ole Martin Gulbrandsen 26 Reputation points
2021-09-07T09:59:12.75+00:00

I am exporting data from my DataGrid, to a Azure Sql database table. But I need to manipulate and do some math with it.

What I'm hoping is possible to do by query, is:

  • Sort data by Column1 (20 entries, with several hundred lines each)
  • Add the contents of all the cells in Column 2, of Column 3 and of Column 4
  • Create two new columns, X and Y
  • Set the content of Column X to be (Column1 * ColumnY / 100)
  • Set the content of Column Y to be a 8
  • I want my table to filled with just 20 lines, the summarization of all the hundreds of line of each entry in Column1.

What I have tried:

Trying to get an idea if this is possible or not to do with a query. I would prefer not to do this "manually" in the DataGrid. Would appreciate a pointer or two in how to approach this.

Azure SQL Database
{count} votes