SELECT k.code, k.name, 
round(avg(sk.score),2) ascore FROM studentkpi sk, kpi k where sk.kpiId = k.id AND sk.studentid = sk.studentid=1
GROUP BY k.code, k.name 

SELECT * From Studentattendance
Update Studentattendance set AttendanceStatus = 'Leave' where AttendanceId = 12

SELECT 
    SUM(CASE WHEN AttendanceStatus = 'Present' THEN 1 ELSE 0 END) P,
    SUM(CASE WHEN AttendanceStatus = 'Absent' THEN 1 ELSE 0 END) A,
    SUM(CASE WHEN AttendanceStatus = 'Leave' THEN 1 ELSE 0 END) L
FROM 
    Studentattendance
WHERE 
    StudentId = 3
