Solved

Inserting Space when a Break Column's Value Changes

Posted on 2012-04-09
3
249 Views
Last Modified: 2012-04-10
Hi,

I want to insert a space when a column's value changes in SQL

ID        LAST_NAME                     SALARY
------------- ------------------------- ----------
20         Hartstein                      13000

80         Russell                           14000
              Partners                       13500

90          King                               24000
              Kochhar                        17000
0
Comment
Question by:VenkatBunny
3 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 37825150
You should use a reporting tool such as SSRS to achieve that.
0
 

Author Comment

by:VenkatBunny
ID: 37826051
Is there Anyway to group the ID by not displaying the ID in MS SQL

ID        LAST_NAME                     SALARY
------------- ------------------------- ----------
20         Hartstein                      13000
80         Russell                           14000
              Partners                       13500
90          King                               24000
              Kochhar                        17000
0
 
LVL 18

Accepted Solution

by:
deighton earned 150 total points
ID: 37827573
SELECT case when rowx = 1 then cast(tt.id as nvarchar(10)) else '' end, tt.Last_name, tt.salary FROM  (select id,last_name,salary,row_number() over (partition by id order by salary) as rowX from YourTable) tt
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question