SQL for Smarties | SQL Programming Style | Trees and Hierarchies in SQL | SQL Puzzles and Answers | Data and Databases


Tuesday, June 12, 2007

add blank row between groups of rows to separate them?

SQL Apprentice Question
I want to add a blank row between groups of rows to separate them.


select * from tbl1 where fname in ('Bill', 'tom', 'sam')


returns


Bill, 1, 2, 3
bill 4, 5, 6
tom, 1, 2, 3
tom, 4, 5, 6
sam, 1, 2, 3
sam, 4, 5, 6


I want to return this:


Bill, 1, 2, 3
bill 4, 5, 6


tom, 1, 2, 3
tom, 4, 5, 6


sam, 1, 2, 3
sam, 4, 5, 6


How can I perform this type of operation with tsql?



Celko Answers
>> How can I perform this type of operation with tsql? <<


Why are you formatting data in the back end? The basic principle of a
tiered architecture is that display is done in the front end and never
in the back end. This a more basic programming principle than just
SQL and RDBMS.

Original Source

No comments: