Recent

Author Topic: Lazreport distinct count  (Read 3306 times)

goodname

  • Sr. Member
  • ****
  • Posts: 297
Lazreport distinct count
« on: October 14, 2011, 07:36:51 pm »
Is it possible to have LazReport do a distinct record count for placement in a footer? Using the sum and count aggregate functions work. For now doing a separate TSQLQuery and putting the result in the footer works.

jesusr

  • Sr. Member
  • ****
  • Posts: 499
Re: Lazreport distinct count
« Reply #1 on: October 15, 2011, 06:38:37 pm »
Can you explain what a distinct record count should do and what is the difference with Count aggregate function?

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: Lazreport distinct count
« Reply #2 on: October 15, 2011, 11:04:55 pm »
Given the following list the count and distinct count will be different.
1,3,7,8,4,2,7,3,4,7
The count is 10.
The distinct count is 6 as the numbers 3,7,4 are repeated so only counted once.

It is done in SQL by placing DISTINCT inside the aggregate.
Code: [Select]
SELECT count(id) from tbl;
SELECT count(DISTINCT id) from tbl;

 

TinyPortal © 2005-2018