Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select distinct rows... 1

Status
Not open for further replies.

rahulroy08

Programmer
Jul 3, 2007
58
US
Hi

I'm using Crystal 8.5 and SQL Server 2005. And when I run the report my reports displays the same data repeatedly. I'm not sure where it is goin wrong.

I checked my database and it has multiple rows with the same name.But I just need the data to be displayed just once.

Can someone help me how to fix this problem.


Thanks,


Rahul.
 
First try going to database->select distinct records. If that doesn't work, it is probably because you are using multiple tables with a many to many relationship.

-LB
 
Hi LB,

It helped me fix the report to some extent. But how do I solve the second issue, the many-->many relationship between the multiple tables.

Rahul.
 
Please show a sample of your records at the detail level and then show a sample of how you would like them to display.

-LB
 
The quick and dirty fix is to create a group at the field level at which you require uniqueness, and then display within the group footer, and suppress the group header and the details.

-k
 
Hi,

Let me be more clear. I have duplicated data and my report looks the following way:

Code:
Emp 1 (Grp-1 main grp)

  sub grp (Peak)

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    ----------------------
    subtotal

  sub grp (Off-Peak)

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    ----------------------
    subtotal

Total

But it is displayed as the follwoing for some employees

Code:
Emp 1 (Grp-1 main grp)

  sub grp (Peak)

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    ----------------------
    subtotal

  sub grp (Off-Peak)

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...

    2007  fld1  fld2  fld3
    2008  fld4  fld5  fld6
    ...
    ----------------------
    subtotal

Total


Can some one please help me with this.


All your valuable suggestions are welcome.


Thanks,


Rahul
 
Place all the fields on the detail section so you can see which field from the first table is causing the duplication.

-LB
 
I did place all the fields in the detail section, and my complete detail section is being duplicated again and again and also its being added to the total at the end (which I dont expect my report to do).

I have now figured out that my database itself has duplicate records,with the same name. And now that I'm grouping it with the name, its pulling up the records with the same name.

Is there any way that I can eliminate the duplicates at the DB end itself.

Please suggest.


Thanks,

Rahul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top