Content

  Title: query02

set @snm = 'm1'; set @pst = 20; set @ext = 10; select tmp.ID as ID, tmp.English as English, v.pro as Pronunciation, v.kor as Korean from (((select res.id as ID, res.eng as English, @ini as Init, @pst as Past, @ext as Extend from (select max(s.id) as id, s.voca_eng as eng from sources s, (select @ini := min(s.id) from sources s where s.source_name collate utf8mb4_unicode_ci = @snm) as var where s.id between @ini and @ini + @pst + @ext - 1 group by s.voca_eng order by ID) as res where res.id < @ini + @pst) order by rand() limit 5) union ((select res.id as ID, res.eng as English, @ini as Init, @pst as Past, @ext as Extend from (select max(s.id) as id, s.voca_eng as eng from sources s where s.id between @ini and (@ini + @pst + @ext - 1) group by s.voca_eng order by ID) as res where res.id between (@ini + @pst) and (@ini + @pst + @ext - 1)) order by rand() limit 5)) as tmp join vocas v on v.eng = tmp.English order by tmp.English;
  •  학생부