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 2000 Forums
 Transact-SQL (2000)
 Hide Repeated Fields

Author  Topic 

cool_moon
Starting Member

26 Posts

Posted - 2006-05-29 : 10:34:17
Hi,
Is there any way that we can remove/hide the repeated field values in the view.

For example.
If we have three fields in the Table.

Country Rates Name
Australia 100 ABC
Australia 105 DEF
Australia 105 GHI
Australia 108 JKL
New Zealand 100 XYZ
New Zealand 101 XYZ
New Zealand 100 XYZ

So, I want to create a view that will show above Table like this:

Country Rates Name
Australia 100 ABC
105 DEF
105 GHI
108 JKL
New Zealand 100 XYZ
101 XYZ
100 XYZ

thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-29 : 10:37:49
The proper method is to use Reports and make use of Suppress if duplicated feature

Madhivanan

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

cool_moon
Starting Member

26 Posts

Posted - 2006-05-29 : 10:58:37
yes true...but can't we do it by creating view?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-29 : 11:00:05
Suppressing the column value should be done in Front end application and not in sql
Where do you want to show the data?

Madhivanan

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

cool_moon
Starting Member

26 Posts

Posted - 2006-05-29 : 11:09:44
The data will be display in a DataGrid(Asp.net C#)
It is possible to hide data field in front end. I just want to take a different approach.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-05-29 : 18:20:07
Don't take a differnet approach.
Special formatting like that is convoluted in sql, because it is not designed for that kind of thing.

Besides if you receive the row:
105 DEF
from the database, it is devoid of meaning, without the country information, it at best states that there exists some country with " 105 DEF "
You could add an order by clause in your select,
but then the client would be responsible for correlating the order of the returned rows with the partial information returned.

Better, return complete information from the datbase, and let the client present it the way it wants.

rockmoose
Go to Top of Page
   

- Advertisement -