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)
 group by blank row

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-15 : 08:42:27
Jay writes "I need to insert blank row after each group in group by select statement

ie

select Fname,Lname,City,State
from table1
group by State,Lname, Fname
order by State

the result should be

OH
OH
OH

Blank row

IL
IL
IL

blank row

Any 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
Go to Top of Page

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 application

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

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 scope

Madhivanan

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

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 State
FROM (
SELECT 1 AS rowtype, Fname, Lname, City, State AS state1
FROM table1

UNION ALL

SELECT 2, '', '', '', State
FROM table1
GROUP BY State
) AS A
ORDER BY state1, rowtype

Go to Top of Page
   

- Advertisement -