December 7, 2008 at 11:40 pm
Hi all,
i need to create table which has main columns and that main columns divided in to same separate columns like as following 2nd table.which table create using following 1st table.please tall me how im i do this?
1st Table
+--------+------+------+-----+-----------+
+ + + + + +
+ Name + Maths+ Engl + Art + Semester +
+ + + + + +
+--------+------+------+-----+-----------+
+ Harsha + 85 + 90 + 78 + 1 +
+--------+------+------+-----+-----------+
+ Mick + 80 + 80 + 78 + 2 +
+--------+----- +------+---- +-----------+
+ Ann + 75 + 90 + 78 + 2 +
+--------+----- +------+-----+-----------+
+ Shone + 65 + 85 + 78 + 4 +
+--------+------+------+----+------------+
+ Jorge + 65 + 55 + 78 + 1 +
+--------+------+------+----+------------+
+ Andrew + 50 + 60 + 78 + 2 +
+--------+------+---- -+-----+------------+
+ Polle + 70 + 78 + 78 + 3 +
+--------+------+-----+--- --+--------- --+
..
..
2nd Table
+--------+-------------------+--------------------+-------------------+-----------------+
+ + 1st Semester + 2nd Semester + 3rd Semester + 4th Semester +
+ Name +------+------+-----+------+------+-----+-----+------------+------------------+
+ +Maths+ Engl + Art + Maths+ Engl + Art +Maths+ Eng l+ Art + Maths+ Engl + Art +
+--------+------+------+-----+------+------+-----+-----+------+-----+-----+-----+-----+
+ Harsha + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+-----+-----+----- +-----+-----+-----+-----+
+ Mick + 80 + 80 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+-----+-----+---- -+-----+-----+-----+-----+
+ Ann + 75 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+----- +----- +-----+-----+-----+------+-----+-----+
+ Shone + 65 + 85 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+-----+-----+----- +-----+-----+-----+-----+
+ Jorge + 65 + 55 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+--- -+-----+-----+-----+---- -+-----+-----+
+ Andrew + 50 + 60 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+-----+-----+------+-----+-----+-----+-----+
+ Polle + 70 + 78 + 78 + 85 + 90 + 78 + 85 + 90 + 78 + 85 + 90 + 78 +
+--------+------+------+-----+------+------+-----+------+------+-----+----+-----+-----+
..
..
December 8, 2008 at 6:11 pm
Use Excel or a reporting tool (like Reporting Services or Crystal Reports) for this kind of output formatting.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
December 8, 2008 at 8:08 pm
Or, you could do a cross-tab...
http://www.sqlservercentral.com/articles/T-SQL/63681/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply