Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Jay writes "I need to insert blank row after each group in group by select statement ie select Fname,Lname,City,Statefrom table1group by State,Lname, Fnameorder by Statethe result should be OHOHOHBlank rowILILILblank rowAny help would be appreciate "
Srinika
Master Smack Fu Yak Hacker
1378 Posts
Posted - 2006-05-15 : 09:04:46
U can do this in the front end Srinika
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts
Posted - 2006-05-15 : 09:05:55
why you want to do this? if for the reporting purpose or formating the data then do this in your front end applicationIf Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2006-05-15 : 09:40:49
Dont try to format the data using sql. Use Front end application which is for that scopeMadhivananFailing to plan is Planning to fail
Arnold Fribble
Yak-finder General
1961 Posts
Posted - 2006-05-15 : 10:50:34
I agree with the others.Otherwise you'd have some monstrosity like this:
SELECT Fname, Lname, City, CASE WHEN rowtype = 1 THEN state1 ELSE '' END AS StateFROM ( SELECT 1 AS rowtype, Fname, Lname, City, State AS state1 FROM table1 UNION ALL SELECT 2, '', '', '', State FROM table1 GROUP BY State ) AS AORDER BY state1, rowtype