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
 General SQL Server Forums
 New to SQL Server Programming
 Remove duplicates

Author  Topic 

pronky11
Starting Member

2 Posts

Posted - 2008-01-09 : 16:38:19
I have a query which gives the following output, How can i get a output like this:

QUERY

COL1
COL2
COL3

A1
AA
GG

A1
BB
HH

A1
CC
JJ

B1
DD
KK

B1
EE
LL

B1
FF
MM


OUTPUT

COL1
COL2
COL3

A1
AA
GG

BB
HH

CC
JJ

B1
DD
KK

EE
LL

FF
MM




TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-09 : 17:12:48
Welcome to sqlteam.com Pronky11!

Are you saying that for COL1 you want to only present the value if it is changed from the previous row? You are not trying to remove duplicate rows, right? If so, that is a report formatting issue. What application are you using to present the results of this query?

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-09 : 23:27:32
This seems to be more of kind of stuff thats need to be done at front end. What front end are you using?
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-01-09 : 23:44:27
it seems you really love whitespace!


elsasoft.org
Go to Top of Page

pronky11
Starting Member

2 Posts

Posted - 2008-01-10 : 11:56:26
Hello All,

Thanks a lot.
I want COL1 to only present the value if it is changed from the previous row and not trying to remove duplicate rows.
I am using excel to submit this report. Can anyone help me how can i do this in excel.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-11 : 02:32:28

quote:
Originally posted by pronky11

Hello All,

Thanks a lot.
I want COL1 to only present the value if it is changed from the previous row and not trying to remove duplicate rows.
I am using excel to submit this report. Can anyone help me how can i do this in excel.


This feature is known as Suppress If Duplicated
You can do it via formula in a cell

1 Export the data to EXCEL sheet
2 Add new column after col1
3 Copy the cell (A1) to (B1)
4 in cell B2, write this formula
=IF(A2=A1,"",A2)
5 Copy the formula to all the rows of column B
6 Hide column A

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -