I am trying to update a Microsoft report. What he does is write out how many customers are excluded from the conversion process and for what reason. Currently, the program writes all the remote clients back to the server, then requests it to fill out the table of specialties with the results.
Here is the current request:
SELECT DeletedClients.Reason, COUNT(DeletedClients.Reason) AS Number, CAST(CAST(COUNT(DeletedClients.Reason) AS float) / CAST(t.Total AS float) * 100 AS numeric(4, 1)) AS percentage FROM DeletedClients CROSS JOIN (SELECT COUNT(*) AS Total FROM DeletedClients AS DeletedClients_1 WHERE (ClinicID = @ClinicID)) AS t WHERE (DeletedClients.ClinicID = @ClinicID) AND (DeletedClients.TotalsIdent = @ident) GROUP BY DeletedClients.Reason, t.Total ORDER BY Number DESC
What I would like to do is not to write DeletedClients to the server, since it already exists in memory in my program as a DataTable, and it just slows down the report and populates the database with information that we do not need to store.
My main question is: Either:
How do I query a data table to create a new data table in memory that has the same results as if I wrote out the SQL server and read it back with the query above?
OR
How in Microsoft Reports do you execute a group by clause for elements in Tablix to turn =Fields!Reason.Value =Fields!Number.Value =Fields!percentage.Value into something similar to the returned query result above?
source share