473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Suppress Repeating Data in SQL Report

I am trying to write a report that displays a hierarchy such as:
Director, Manager, Employee
I want to suppress the repeating Director, Manager for the employees.

This is my code:
sSQL = "SELECT FY99Info.MDName, FY99Info.MgrName, FY99Info.firstname,
FY99Info.lastname, FY99Info.grade
FROM FY99Info
WHERE left(FY99Info.orgcode,5) = '" & left(session("MOrg"),5) & "' and
FY99Info.mgmtlevel < 4
ORDER by FY99Info.MDName, FY99Info.orgcode, FY99Info.mgmtlevel desc "

This is the SQL table layout (FY99Info).
Emp# Org Director Manager Employee Mgmtlevel
1 10336088 Brian Smith Michael Smart Bill Mitchell 0
2 10336088 Brian Smith Michael Smart Heidi Rainey 0
3 10336088 Brian Smith Michael Smart Ponita Asnor 2
4 10336088 Brian Smith Michael Smart Marcus Jones 0
5 10607655 Rick Doe Glenn Thomas Helen Kelley 0
6 10607655 Rick Doe Glenn Thomas Gaston Knight 2
7 10607655 Rick Doe Helen Black Prentis Parker 0
8 10607655 Rick Doe Helen Black Billie Spike 0
9 10739900 Jason Smart Tim Snow Joe Monty 3
10 10739900 Jason Smart Tim Snow Randi Bull 3
11 10739900 Jason Smart Tim Snow Misty Wonton 2
This is how I want it to display on the report
MD Manager Employee
Brian Smith Michael Smart Bill Mitchell
Heidi Rainey
Ponita Asnor
Marcus Jones
Rick Doe Glenn Thomas Helen Kelley
Gaston Knight
Helen Black Prentis Parker
Billie Spike
Jason Smart Tim Snow Joe Monty
Randi Bull
Misty Wonton

Jan 10 '07 #1
2 4910
This is best solved in your reporting tool. Most tools have suppress
duplicates option (I know for sure Crystal Reports has it). You just need to
check it for the selected report columns.

Regards,

Plamen Ratchev
http://www.SQLStudio.com
"pmarisole" <jb******@midsouth.rr.comwrote in message
news:11**********************@k58g2000hse.googlegr oups.com...
>I am trying to write a report that displays a hierarchy such as:
Director, Manager, Employee
I want to suppress the repeating Director, Manager for the employees.

This is my code:
sSQL = "SELECT FY99Info.MDName, FY99Info.MgrName, FY99Info.firstname,
FY99Info.lastname, FY99Info.grade
FROM FY99Info
WHERE left(FY99Info.orgcode,5) = '" & left(session("MOrg"),5) & "' and
FY99Info.mgmtlevel < 4
ORDER by FY99Info.MDName, FY99Info.orgcode, FY99Info.mgmtlevel desc "

This is the SQL table layout (FY99Info).
Emp# Org Director Manager Employee Mgmtlevel
1 10336088 Brian Smith Michael Smart Bill Mitchell 0
2 10336088 Brian Smith Michael Smart Heidi Rainey 0
3 10336088 Brian Smith Michael Smart Ponita Asnor 2
4 10336088 Brian Smith Michael Smart Marcus Jones 0
5 10607655 Rick Doe Glenn Thomas Helen Kelley 0
6 10607655 Rick Doe Glenn Thomas Gaston Knight 2
7 10607655 Rick Doe Helen Black Prentis Parker 0
8 10607655 Rick Doe Helen Black Billie Spike 0
9 10739900 Jason Smart Tim Snow Joe Monty 3
10 10739900 Jason Smart Tim Snow Randi Bull 3
11 10739900 Jason Smart Tim Snow Misty Wonton 2
This is how I want it to display on the report
MD Manager Employee
Brian Smith Michael Smart Bill Mitchell
Heidi Rainey
Ponita Asnor
Marcus Jones
Rick Doe Glenn Thomas Helen Kelley
Gaston Knight
Helen Black Prentis Parker
Billie Spike
Jason Smart Tim Snow Joe Monty
Randi Bull
Misty Wonton

Jan 10 '07 #2
pmarisole (jb******@midsouth.rr.com) writes:
I am trying to write a report that displays a hierarchy such as:
Director, Manager, Employee
I want to suppress the repeating Director, Manager for the employees.
Do you use Reporting Services? In such case, you may get better
assitance in microsoft.public.sqlserver.reportingsvcs.

Or do you want your query to produce this result:
This is how I want it to display on the report

MD Manager Employee
Brian Smith Michael Smart Bill Mitchell
Heidi Rainey
Ponita Asnor
Marcus Jones
Rick Doe Glenn Thomas Helen Kelley
Gaston Knight
Helen Black Prentis Parker
Billie Spike
Jason Smart Tim Snow Joe Monty
Randi Bull
Misty Wonton
Please don't even think of it. It's not impossible, but it would
be complicated. Do this in your report tool, as this is standard
stuff for whichever tool you are using.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jon Bosker | last post by:
Hi I am trying to get my timesheet report to look good but my date keeps repeating and I do not want it to. I cannot understand how to implement the Meuchian technique here though it seems to...
2
by: Kelly Pearson | last post by:
Is it possible to suppress duplicate values on repeating rows of a datagrid? For example: dept. name ------- ------------ acct joe smith mary jones <--- acct suppressed payroll ...
2
by: Emilio Jimonerz | last post by:
Hello. I am developing a project tracking database that records the following information: 1. Project name 2. Lead person(s) 3. Support person(s) 4. Clients 5. Contacts The data is organized...
4
by: Robert | last post by:
Is there some way to suppress the automatic line feed in the detail section of a report in Access? I would like the detail to print out to the right of the existing one. The next line would be...
2
by: Alpha | last post by:
I have a C# program that user would select several search criteria and then outputs to the Crystal Report. A message is output to user if no matching record is found. In my code I also clear,...
10
by: Jason Pettys | last post by:
I have an ASP.NET page that my client wants to e-mail. So in IE we choose File > Send > Page by E-mail, which opens up either Outlook or Outlook Express with the HTML page content as the message...
55
by: tulikapuri | last post by:
I am developing a DB for a lab and at the end of the day i need to generate reports and send by email to supervisors, i had seven different reports to begin with, which i have brought down to 3, by...
0
by: marcellus7 | last post by:
Hows it going everyone. Im pretty new to Crystal Reports, and am in the process of trying to setup my first Crystal Report in my windows app. I am loading data from a DataSet, and am finally getting...
0
by: dragon52 | last post by:
Hi there, I have records in the form of scorecards. Each scorecard has fields "type" and "score". eg typeA 2.3 typeB 3.3 typeA 2.0 typeC 1.9 typeB 1.1
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.