SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 group by blank row
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 05/15/2006 :  08:42:27  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

Sri Lanka
1378 Posts

Posted - 05/15/2006 :  09:04:46  Show Profile  Reply with Quote
U can do this in the front end



Srinika
Go to Top of Page

chiragkhabaria
Flowing Fount of Yak Knowledge

India
1907 Posts

Posted - 05/15/2006 :  09:05:55  Show Profile  Visit chiragkhabaria's Homepage  Send chiragkhabaria a Yahoo! Message  Reply with Quote
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

India
22713 Posts

Posted - 05/15/2006 :  09:40:49  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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

United Kingdom
1961 Posts

Posted - 05/15/2006 :  10:50:34  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000