KB-43139: Fields’ subtraction result in a report.

Question:

How can I show data from a query in a report, as well as the difference between the first and the last values of the fields?

Solution:

It is not possible to insert two different queries in the report; therefore, you must create columns in the query with the result of the differences. The query will look like this:

SELECT E3TimeStamp, Field1, Field 2, Totals.Sub Field 1, Totals.Sub Field 2 FROM ReportTable,
(select last.field1 – first.field1 as SubField1, last.field2 – first.field2 as SubField2 from
(SELECT top 1 E3Timestamp, Field1, Field2 from ReportTest order by e3timestamp ASC) first,
(SELECT top 1 E3Timestamp, Field1, Field2 from ReportTest order by e3timestamp desc) last) Totals ORDER BY ReportTest.E3TimeStamp ASC

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *