Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Need help with grouping Post Reply Post New Topic
Author Message
MedicMatt
Newbie
Newbie


Joined: 29 Jan 2012
Online Status: Offline
Posts: 1
Quote MedicMatt Replybullet Topic: Need help with grouping
    Posted: 29 Jan 2012 at 11:00pm
I work for an ambulance company and we have a database that stores information from all of our emergency runs.  In one table it keeps information about the crew that ran the call.  Things like driver name, attendant name, vehicle number, etc.  I need to be able to count the number of trips an individual employee has run.  That Employee's name could be in either column (driver or attendant).  I can't seem to get both totalled under one group heading.
 
I want it to look something like:
 
Doe, John
   Type of Call                 Number of Calls
      ALS                                     #
      BLS                                     #
      Cancelled                           #
 
Doe, Jane
   etc, etc, etc
 
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 29 Jan 2012 at 11:19pm

I'm not sure of anyway using Crystal directly (maybe subreports), this would be possible using derived tables in a SQL command though. I'd need more information regarding the tables in your database and how they're joined before I could begin to help you write a query though.

 
If you're familiar with SQL, the following should get you started;
 
Select
call.driver as 'Employee',
'Driver' as 'Role',
call.calltype
from call
union all
select
call.attendant as 'Employee',
'Attendant' as 'Role',
call.calltype
from call
 
Basically all that will do will list all calls made twice, once with the drivers name in the employee column, then again with the attendants name in the same column - which will allow you to group by "Employee" to get a total count of calls they were involved in.
 
Regards,
Ryan.


Edited by rkrowland - 29 Jan 2012 at 11:42pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.