hi ,I started to implement a attendance system. I need to render a view as matrix such that colums specify dates and rows specify student names. Their intersection represents existence of the student at that date in lecture.
i have tables:
CREATE TABLE AttendanceList
(
alid
int(11) NOT NULL AUTO_INCREMENT,
attendancedate
date DEFAULT NULL,
duration
int(11) DEFAULT NULL,
courseid
int(11) DEFAULT NULL,
PRIMARY KEY (alid
),
KEY courseid
(courseid
)
)
and
CREATE TABLE AttendanceInfo
(
aid
int(11) NOT NULL AUTO_INCREMENT,
studentid
int(11) DEFAULT NULL,
studentname
char(40) DEFAULT NULL,
attendancelistid
int(11) DEFAULT NULL,
PRIMARY KEY (aid
),
KEY attendancelistid
(attendancelistid
)
)
i am using to get data from these tables
SELECT studentname, attendancedate
FROM AttendanceInfo i
JOIN (
SELECT *
FROM AttendanceList
WHERE courseid =498
)l ON i.attendancelistid = l.alid
thanks in advance.