Avatar of garyjgs
Flag for United States of America asked on

Grouping ranges in SQL for Crystal Reports

I am creating a Crystal Report using SQL.  The Crystal Report has to display various ranges (or Groups) that are not contigous.  For example, this is a comparison report which displays FTE data at the top of the page. Then there is Revenue data which is then displayed.  Expenses is the third grouping.  Last group in the report is more statistical data.

"Account Nr."       "FTEs Count"   "Actuals"  "Flex Budget"   "Static Budget"

"Account Nr."        "Revenue"      "Actuals"  "Flex Budget"  "Static Budget"


"Account Nr."        "Expenses"      "Actuals" "Flex Budget"    "Static Budget"

I was trying to avoid using Groups in Crystal Reports.  Is there a way to group this in a SQL statement?
Crystal ReportsSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon
Mike McCracken

There probably is.

Can you build it in the database?

With SQL you can add a GROUP BY clause and list the fields to group by in the appropriate order.

Or you could just sort based on those fields.

How are you handling the summary data in Crystal?


I haven't addressed that yet.  I am still in the design phase.
Mike McCracken

That is when you need to address it.

Assuming a record only goes in one group, the easiest way to do this is to create the groups in the report and let the report do the work of grouping.

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question