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
 General SQL Server Forums
 New to SQL Server Programming
 Display Colum as header

Author  Topic 

btkaruna
Starting Member

8 Posts

Posted - 2010-06-23 : 06:20:36
Hi,

I am able to generate records in following format using group by
Branchid Name Mobile
1 Harsha Priyadarshini 9989651451
1 Bhanu Prakash 323232320
1 hari Prakash 323232
1 Saritha 3223233232
2 vamsi 9989651451
2 karuna 323232320
2 surya 323232
2 Saritha 3223233232
But i need to generate records in the following manner

Branchid : 1
Name Mobile
Harsha Priyadarshini 9989651451
Bhanu Prakash 323232320
Bhanu Prakash 323232
Saritha 3223233232

Branchid : 2
vamsi 9989651451
karuna 323232320
surya 323232
Saritha 3223233232

Thanks

Sachin.Nand

2937 Posts

Posted - 2010-06-23 : 06:34:55
You want that o/p to be generated by SQL?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

btkaruna
Starting Member

8 Posts

Posted - 2010-06-23 : 06:37:59
yes, i require sql to get the out put.
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-06-23 : 07:02:48
Why. -- This is an easy thing to do in your application layer. just keep a count of the first column and output the Branchild : <number> only when it changes.

This is awkward, slow and ugly to do in sql


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-06-23 : 07:54:43
Any reporting tool can do it in a jippy.Just set Branchid as Group section and place Name,Mobile in Details section under group section.If using asp.net u can do it using repeater control
Have a look here
http://www.c-harpcorner.com/UploadFile/DipalChoksi/MasterDetailedDisplay11242005064831AM/MasterDetailedDisplay.aspx


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page
   

- Advertisement -