Hai all,
I have 3 tables called timetablemaster,timetabledetails and staff.
Here are my table Structure
timetablemaster
ttId, ttTitle, classCode, sectionCode, startTime, validFrom, validTo, startDate, endDay, noOfClasses
timetabledetails
ttDetailsId, ttId, day, period, subjectCode, staffCode
staff
staffId, staffCode, firstName
select s.firstName as Staff, tm.classCode as Class, td.day as Day, td.period as Periods
from timetabledetails td, timetablemaster tm, staff s where s.staffCode = td.staffCode and td.ttId = tm.ttId and td.staffCode like 'S01';
From this query i am getting this format
Staff | Class | Day | Period |
Abc | STD1 | Monday | 1 |
Abc | STD1 | Tuesday| 5 |
Abc | STD1 | Wednesday | 4 |
Abc | STD1 | Thursday | 2 |
Abc | STD1 | Friday | 3 |
Abc | STD1 | Saturday | 3 |
Abc | STD2 | Monday | 5 |
Abc | STD2 | Tuesday| 4 |
Abc | STD2 | Wednesday | 3 |
Abc | STD2 | Thursday | 2 |
Abc | STD2 | Friday | 1 |
.
.
.
.
But I need to display the Table in this format in Gridview
|Monday|
StaffName | Period1 | Period2 | Period3 | Period4 | Period5
Abc | STD1 | STD2 | STD3 | STD1 | STD2
.
.
Xyz | STD3 | STD5 | STD1 | STD4 | STD1
Pqr | STD2 | STD3 | STD4 | STD1 | STD3
.
.
.
.
Anybody know how to do this? Thanks very much!