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
 MS SQL Query Question

Author  Topic 

SQLGuruji
Starting Member

6 Posts

Posted - 2010-01-10 : 13:52:37
Hello,

I need help in writing a query to display table data. The structure of data as follows:

TableA:
BookID BookName ChapNo ChapName ExID ExName
1 abcd 1 xyz 5 bbp
1 abcd 1 xyz 6 ppo
1 abcd 2 zoq 4 oop
2 efgh 1 ffg 3 rrt
2 gghf 1 clk 9 crt

I want to display data like:

BookID: 1 --- BookName: abcd
Chapter No. 1 --- xyz
ExerciseID: 5 --- Exercise Name: bbp
ExerciseID: 6 --- Exercise Name: ppo

Chapter No. 2 --- Chapter Name: zoq
ExerciseID: 4 --- Exercise Name: oop

BookID: 2 --- BookName: efgh
Chapter No. 1 --- ffg
ExerciseID: 3 --- Exercise Name: rrt
ExerciseID: 9 --- Exercise Name: crt

Can any help me write query to display the results as required, thanks.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2010-01-10 : 14:17:29
You can't do in SQL Query.You need to use reporting Layout tools for it.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-01-10 : 17:09:56
your result can be queried but query might get very long. is this something you need dynamic or static? if later, code can be written, otherwise, use ReprotingServices or 3-party application for displaying data.
Go to Top of Page
   

- Advertisement -