Need urgent help with SQL code

Need urgent help with SQL code

by ebru H-T -
Number of replies: 2

Dear All,

I have sql code and  I tried to add date(with time) columnin the table but when I insert the date code then it says database error. 

COULD YOU SOMBODY CAN HELP ME TO GET DATE OF STUDENTS ACCESS AS WELL MY CODE S FOLLOWS; ALSO WANT FILTER BY START AND END DATE SO I CAN CHOOSE THE SPECIFIC  DATE 

SELECT u.firstname AS 'Name' , u.lastname AS 'Surname', c.fullname AS 'Course', cc.name AS 'Category', 

CASE WHEN gi.itemtype = 'Course'    

THEN c.fullname + ' Course Total'  

ELSE gi.itemname 

END AS 'Item Name', ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS MAX, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) AS Percentage,

 

IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 79,'Yes' , 'No') AS Pass

 

FROM prefix_course AS c 

JOIN prefix_context AS ctx ON c.id = ctx.instanceid 

JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id 

JOIN prefix_user AS u ON u.id = ra.userid 

JOIN prefix_grade_grades AS gg ON gg.userid = u.id 

JOIN prefix_grade_items AS gi ON gi.id = gg.itemid 

JOIN prefix_course_categories AS cc ON cc.id = c.category 

WHERE  gi.courseid = c.id AND gi.itemname != 'Attendance'

ORDER BY `Surname` ASC 



PLEASE HELPME AND I NEED URGENT ANSWER İF YOU CAN


THANKS

 

Average of ratings: -
In reply to ebru H-T

Re: Need urgent help with SQL code

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

What is the cause of the urgency?

In reply to Marcus Green

Ynt: Re: Need urgent help with SQL code

by ebru H-T -

Because most of the staff name did not appear in the normal completion report and we are missing their name to update their manadtory traning course in our system. 

I put this sql code and try it brings all name that I need as people whoes names did not come up with course completion, came with this course and I have to sort it out as soon as possible. 


i only need to add date field. I tried to put code in but it gives me database error. i put something lik this (also is there any way to get date and time from scorm table- such as access date and time to scorm course)


from_unixtime(st.timemodified) as 'end time'

%%FILTER_STARTTIME:st.timemodified:>%% 

%%FILTER_ENDTIME:st.timemodified:<%%


if you can give me suggestion that would be really appreciated