Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 562455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:33:23+00:00 2026-05-13T12:33:23+00:00

I have an SQL query like SELECT GNTD_SCHEDULE_CODE SCHEDULE, GNTD_PARENT_ACCT PARENT_ACCOUNT, GNTD_ACCOUNT_CODE ACCOUNT, GNTD_COMP_CODE,

  • 0

I have an SQL query like

SELECT
             GNTD_SCHEDULE_CODE SCHEDULE,
             GNTD_PARENT_ACCT PARENT_ACCOUNT,
             GNTD_ACCOUNT_CODE ACCOUNT,
             GNTD_COMP_CODE,
             SUM(CONVERT(FLOAT, ISNULL(GNTD_CUR_MNTH_ACT, 0))) CURR_MONTH_END,
             SUM(CONVERT(FLOAT, ISNULL(GNTD_PRV_PRD_ACT, 0))) PREV_MONTH_END,
             SUM(CONVERT(FLOAT, ISNULL(GNTD_CUR_YEA_YTD_ACT, 0))) CURR_YEAR_END,
             SUM(CONVERT(FLOAT, ISNULL(GNTD_LST_YEA_YTD_ACT, 0))) PRV_YEAR_END
    FROM  GLAS_NLMR_PROCESSED_DATA 
    WHERE    GNTD_COMP_CODE  = '1' 
 AND GNTD_ACCT_TYPE = 'P' AND 
GNTD_DEP_CODE = isnull ( '01' , GNTD_DEP_CODE)
GROUP BY GNTD_COMP_CODE , GNTD_SCHEDULE_CODE , GNTD_PARENT_ACCT , GNTD_ACCOUNT_CODE
HAVING ( SUM ( isnull ( GNTD_CUR_YEA_YTD_ACT , 0)) <> 0) OR ( SUM ( isnull ( GNTD_CUR_MNTH_ACT , 0)) <> 0)

I am using asp.net crystal report formula editor to conver above query like

{GLAS_NLMR_PROCESSED_DATA.GNTD_COMP_CODE} = {?Company} and
if({?Dept Code})=""
then
  {GLAS_NLMR_PROCESSED_DATA.GNTD_DEP_CODE}="01"
else
  {GLAS_NLMR_PROCESSED_DATA.GNTD_DEP_CODE} = {?Dept Code} and

I dont know how to use group by and having statement in crystal report.

How can i?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:33:23+00:00Added an answer on May 13, 2026 at 12:33 pm

    You can add grouping to a report by right-clicking, and selecting Insert -> Group, and then selecting the field you want to group on. Repeat this process to add more groups.

    The ‘having’ is a little tricky to do in the report. You need to use a supression formula. Create a summary field in your group footer (right-click, Insert -> Summary, the select the field and the ‘sum’ operation). Then, in the section expert, add click the ‘Suppress’ button and add a formula like this:

    WhilePrintingRecords;
    Sum({summary_field_name}) = 0;
    

    Add this formula in the group header, details, and group footer, and then do it again for each ‘having’ clause you want to implement.

    FYI – This is probably more efficiently done in the database, using the query you already have.

    Edit: More Info

    You do not use the formula editor to create a summary field. Use Insert -> Summary as described above to create the field. Then, in the Suppress formula, select the new summary field from the ‘Report Fields’ list. It will be named something like ‘Sum of ‘

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 283k
  • Answers 283k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer class->name = name isn't doing what you think it is.… May 13, 2026 at 4:17 pm
  • Editorial Team
    Editorial Team added an answer This does not seem possible at this time. May 13, 2026 at 4:17 pm
  • Editorial Team
    Editorial Team added an answer Your page runs out of content before it finishes scrolling… May 13, 2026 at 4:17 pm

Related Questions

I have an SQL query like this. When iam executing it though my php
I have just optimised some Ruby code that was in a controller method, replacing
I am currently trying to optimize a few queries and scripts, and I wonder
I have an existing, fairly lengthy, SQL query. I would like to select records
If I have a query like: Select EmployeeId From Employee Where EmployeeTypeId IN (1,2,3)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.