Moodle SQL - 使用2个用户配置文件字段数据创建过滤器

时间:2016-12-16 06:01:10

标签: mysql moodle

使用可配置报告插件的这个moodle sql的新功能。

SELECT u.username AS 'User name',
u.firstname AS 'First name',
u.lastname AS 'Last Name',
c.fullname AS 'Course',
u.department AS 'department',
DATE_FORMAT(FROM_UNIXTIME(p.timeenrolled),'%m/%d/%Y') AS 'Enrollment Date',
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted),'%m/%d/%Y') AS 'Completion Date',
DATE_FORMAT(DATE_ADD(FROM_UNIXTIME(p.timecompleted),INTERVAL 1 YEAR), '%Y-%m-%d') AS 'Expiration Date' 

FROM prefix_course_completions AS p
JOIN prefix_course AS c ON p.course = c.id
JOIN prefix_user AS u ON p.userid = u.id

WHERE 1 = 1
%%FILTER_SUBCATEGORIES:cc.path%% 
%%FILTER_COURSES:Course%%
%%FILTER_USERS:Department%%
%%FILTER_SEARCHTEXT:u.firstname:~ %%
ORDER BY u.firstname

有没有办法可以使用名字和姓氏过滤搜索文本?

喜欢:%%FILTER_SEARCHTEXT:u.firstname:~ + u.lastname:~ %%或者我应该将它们联系起来让它发挥作用? Haven在moodle社区和可配置的报告文档中找不到任何相关信息。

1 个答案:

答案 0 :(得分:0)

CONCAT适合我;)

%%FILTER_SEARCHTEXT:CONCAT (u.firstname, ' ',u.lastname):~%%