LMSouq
moodle-core Open

Moodle: using mysql joins in $table = set_sql(); method

KC
kcay King
1 month ago
3 views
Problem Description
I want to know how joins are applied for **$table= set_sql();** method. I'm trying to render a table without using the conventional **html_table();** method. A basic application for a single database table "mdl_user": $table->set_sql('*', "{user}", '1'); But I intend to achieve more complex sql query using joins as shown below: **SELECT aa.firstname, aa.email, zz.fullname FROM mdl_table1 aa INNER JOIN mdl_table2 zz ON aa.id = zz.userid WHERE lastlogin => ? and lastlogin <= ? GROUP BY firtname;** This link below might be helpful. I've tried to work around it but still not clear about it. https://docs.moodle.org/dev/lib/tablelib.php

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base