I am in need of a more exprerienced developer here.
what's the query to execute to find out which section is not used (== has no resources and activities inside) ?
I just want if there is not one empty available to add a new one in the database . Which are these steps to add a section in the database?
Thanks in advance
what's the query to execute to find out which section has no resourses or activities?
by aggelos panagiotakis -
Number of replies: 3
In reply to aggelos panagiotakis
Re: what's the query to execute to find out which section has no resourses or activities?
by Greg Lyon -
I don't know the exact one you will want, but I suggest looking here: http://xref.moodle.org/nav.html?_functions/index.html and searching on 'section'. You'll almost certainly find some useful functions there!
In reply to Greg Lyon
Re: what's the query to execute to find out which section has no resourses or activities?
by aggelos panagiotakis -
i saw that this is for moodle version 1.7
anything on 1.6.3?
what would be really helpfull is to know what ( database ) relationships exist with the table of sections with the one with resourses and the reason the field sequence exists.
so ... the question remains :
whats the way (query ) to find out if a section "is beeing used"/ "contains resources and/or actinities"
anything on 1.6.3?
what would be really helpfull is to know what ( database ) relationships exist with the table of sections with the one with resourses and the reason the field sequence exists.
so ... the question remains :
whats the way (query ) to find out if a section "is beeing used"/ "contains resources and/or actinities"
In reply to aggelos panagiotakis
Re: what's the query to execute to find out which section has no resourses or activities?
by aggelos panagiotakis -
For those who want to help here is some graphical representations of the moodle database schema
http://moodle.org/mod/forum/discuss.php?d=3935
i experimented a little with mysql and tried to find out series of missing entries in the sections datatable.
//Find ranges of missing values with subqueries
select start, stop from (
select m.section + 1 as start,
(select min(id) - 1 from mdl_course_sections as x where x.section > m.section) as stop
from mdl_course_sections as m
left outer join mdl_course_sections as r on m.section = r.section - 1
where r.section is null
) as x
where stop is not null;
http://moodle.org/mod/forum/discuss.php?d=3935
i experimented a little with mysql and tried to find out series of missing entries in the sections datatable.
//Find ranges of missing values with subqueries
select start, stop from (
select m.section + 1 as start,
(select min(id) - 1 from mdl_course_sections as x where x.section > m.section) as stop
from mdl_course_sections as m
left outer join mdl_course_sections as r on m.section = r.section - 1
where r.section is null
) as x
where stop is not null;