Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Hiding duplicate field in results

Author  Topic 

fralo
Posting Yak Master

161 Posts

Posted - 2012-09-17 : 10:22:21
Hi,

I'm wondering if you know of an easy way to accomplish the following.

Given a simple query:

SELECT OFFENSENO, REP_DATE, OFFDESC, SUPDATE, DISP01, FSN
FROM OFFENSE ORDER BY OFFENSENO

Which returns a result set like this...

197 9/6/2012 72-0 9/11/2012 572 794.023.2a
197 9/6/2012 72-0 9/11/2012 608 806.13.1b1
197 9/6/2012 72-0 9/11/2012 576 810.02.3a
198 9/6/2012 72-0 9/11/2012 581 812.014.2c1
199 9/7/2012 72-0 9/8/2012 573 800.04.5c1
199 9/8/2012 72-0 9/11/2012 572 794.011.4
369 9/9/2012 72-0 9/10/2012 574 794.011.3

Can I blank out all duplicate showings of the first field, so that the results come back as follows...

197 9/6/2012 72-0 9/11/2012 572 794.023.2a
9/6/2012 72-0 9/11/2012 608 806.13.1b1
9/6/2012 72-0 9/11/2012 576 810.02.3a
198 9/6/2012 72-0 9/11/2012 581 812.014.2c1
199 9/7/2012 72-0 9/8/2012 573 800.04.5c1
9/8/2012 72-0 9/11/2012 572 794.011.4
369 9/9/2012 72-0 9/10/2012 574 794.011.3

Any help you could provide would be appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-17 : 11:05:06
this is a presentation issue and can be best dealt with in front end tools. Most reporting tools have this feature in built. its called remove duplicates in SSRS and can be accessed from cell properties

Implementing this in sql would be really dirty

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

fralo
Posting Yak Master

161 Posts

Posted - 2012-09-17 : 11:36:34
That's what I was thinking. Thanks for your response. I found a feature in my front end application which allows me to do this.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-17 : 11:40:13
cool

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -