SELECT replace convert group_concat sbj_abbreviation using utf8 as sub

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
SELECT replace(convert(group_concat(sbj_abbreviation) using utf8),',',' / ') as subject,
replace(convert(group_concat(occ_short) using utf8),',',' / ') as type,
replace(convert(group_concat(plc_full_name) using utf8),',',' / ') as place,
replace(convert(group_concat(concat(SUBSTRING_INDEX(stf_fio,' ',1),' ',
SUBSTRING(SUBSTRING(SUBSTRING_INDEX(stf_fio,' ',2),POSITION(' ' in stf_fio)+1),1,1),'.',
SUBSTRING(SUBSTRING_INDEX(stf_fio,' ',-1),1,1),'.'))using utf8),',',' / ') as tutor,
ttb_num+1 as number
FROM univer.pairtime LEFT JOIN (univer.timetable, univer.subjects) ON
(ttb_num+1 = prt_id
AND ttb_sbj_id = sbj_id
AND ttb_date = '{$this->begin_date}'
AND ttb_grp_id = {$this->group_id}
AND if(DayOfWeek(ttb_date+ttb_week_day)-1,DayOfWeek(ttb_date+ttb_week_day)-1,7) = $k)
LEFT JOIN(univer.stuff, univer.tutors) ON (
ttb_ttr_id = ttr_id AND ttr_stf_id = stf_id)
LEFT JOIN univer.occupation ON ttb_occ_id = occ_id
LEFT JOIN univer.place ON ttb_plc_id = plc_id
group by prt_id;