Solved

Inserting Space when a Break Column's Value Changes

Posted on 2012-04-09
3
247 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to share SSIS Package? 6 37
This query failed in sql 2014 5 32
Help in Bulk Insert 9 35
Loops and updating in SQL Query 9 33
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

831 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