October 21, 2011 at 1:22 am
Hello Friends,
I've one table where I displayed School Attendance Summary for one month.
But it is displayed vertically.
I want to Dispaly it Horizontally and according to date.
Here Name appears multple times. I want to display it one time only like this.
Please check the Image for Table Design
Thanks
October 21, 2011 at 4:26 am
hi,
you can achieve this through pivot here is an example of that
USE AdventureWorks
GO
SELECT [CA], [AZ], [TX]
FROM
(
SELECT sp.StateProvinceCode
FROM Person.Address a
INNER JOIN Person.StateProvince sp
ON a.StateProvinceID = sp.StateProvinceID
) p
PIVOT
(
COUNT (StateProvinceCode)
FOR StateProvinceCode
IN ([CA], [AZ], [TX])
) AS pvt;
in your case if the class attendencedate is varying then you might have to do it via dynamic sql
follow this link for that.
October 21, 2011 at 4:45 am
Yes here ClassAttendanceDate vary according to months.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply