Ask Your Question
0

How do I count grouped records in Base report

asked 2014-11-20 19:23:26 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Mac OS X 10.6.8 and LibreOffice Base Version: 4.3.4.1 I created the database in Base from scratch. I created a report in Base with data grouped by a particular field value. So far so good. Now I want to display a record count in the group header for each group in the report, i.e., Volunteers = 45.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-01-07 17:04:09 +0200

Berteh gravatar image

updated 2015-01-07 17:04:48 +0200

I would create a view that adds to your data one column with this count for each entry, and then use it as any other field in the report.

The view (or query) code would be something like below, provided your data table is called "data" and the field your gather your group info from is called "group":

SELECT * , (
   SELECT COUNT( * )  FROM data AS t2
   WHERE t1.group = t2.group
) AS `num`
FROM data AS t1

Other means exist to "count" the population of a group that might be more efficient, see a.o. http://stackoverflow.com/questions/12...

hope this helps.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2014-11-20 19:23:26 +0200

Seen: 3,502 times

Last updated: Jan 07 '15