[parts]
select CAST(max(t_rotation.num_rotation + 999)/ 1000 as signed) as parts from t_rotation
[select]
select
t_rotation.num_rotation as db_id,
IF(s22 is not null and s22 <> '', CONCAT('MM\\', s22), IF(t_rotation.num_type=0 OR t_type.name IS NULL,'Zenon\\Noname',CONCAT('Zenon\\', t_type.name))) as category,
CONCAT(
'\\\\KRHH-S05\\ZenonRoot\\Sounds\\',
IF(t_rotation.num_type=0 OR t_rotation.num_type=1 OR t_rotation.num_type=2 OR t_rotation.num_type=44, CONCAT(t_type.name,'\\'), ''),
CAST((t_rotation.num_rotation/1000000000) %10 as CHAR(1)),
CAST((t_rotation.num_rotation/100000000) %10 as CHAR(1)),
'\\',
CAST((t_rotation.num_rotation/10000000) %10 as CHAR(1)),
CAST((t_rotation.num_rotation/1000000) %10 as CHAR(1)),
'\\',
CAST((t_rotation.num_rotation/100000) %10 as CHAR(1)),
CAST((t_rotation.num_rotation/10000) %10 as CHAR(1)),
'\\',
CAST((t_rotation.num_rotation/1000) %10 as CHAR(1)),
CAST((t_rotation.num_rotation/100) %10 as CHAR(1)),
'\\',
CAST((t_rotation.num_rotation/10) %10 as CHAR(1)),
CAST((t_rotation.num_rotation) %10 as CHAR(1)),
'.mp2') as file_full_name,
t_rotation.Name as attrib_Artists,
t_rotation.Title as title,
CASE t_rotation.num_type
WHEN 2 THEN t_rotation.ID
WHEN 19 THEN t_rotation.ID
ELSE t_rotation.Title
END as title,
CASE t_rotation.num_type
WHEN 2 THEN 1
WHEN 19 THEN 1
WHEN 17 THEN 2
WHEN 86 THEN 2
WHEN 20 THEN 2
WHEN 32 THEN 2
WHEN 35 THEN 2
WHEN 39 THEN 2
WHEN 56 THEN 2
WHEN 90 THEN 2
WHEN 63 THEN 2
WHEN 64 THEN 2
WHEN 65 THEN 2
WHEN 66 THEN 2
WHEN 99 THEN 2
WHEN 88 THEN 2
WHEN 68 THEN 2
WHEN 21 THEN 2
WHEN 3 THEN 4
WHEN 4 THEN 4
WHEN 6 THEN 4
WHEN 9 THEN 4
WHEN 10 THEN 4
WHEN 16 THEN 4
WHEN 22 THEN 4
WHEN 27 THEN 4
WHEN 8 THEN 4
WHEN 30 THEN 4
WHEN 31 THEN 4
WHEN 34 THEN 4
WHEN 40 THEN 4
WHEN 55 THEN 4
WHEN 26 THEN 4
WHEN 33 THEN 4
WHEN 80 THEN 4
WHEN 11 THEN 5
WHEN 12 THEN 5
WHEN 43 THEN 5
WHEN 13 THEN 5
WHEN 77 THEN 5
ELSE 3
END as `type`,
t_rotation.INTRO as intro1_ms, /*нужно выбрать в какой из intro1_ms экспортировать*/
t_rotation.INTRO2 as intro2_ms,
t_rotation.INTRO3 as intro3_ms,
t_rotation.outro as outro_ms,
t_rotation.FADE_IN as fade_in_ms,
t_rotation.FADE_OUT as fade_out_ms,
t_rotation.CUT_IN as start_ms,
t_rotation.CUT_OUT as stop_ms,
t_rotation.LENGTH as duration_ms,
t_rotation.s15 as album, /*добавить в код*/
t_rotation.MODIFICATION_DATE as modify_str_date,
t_rotation.s1 as attrib_Titel_GEMA,
t_rotation.s2 as attrib_Komponist_GEMA,
t_rotation.s3 as attrib_Todesjahr_K_T,
t_rotation.s4 as attrib_SolistIn_intern,
t_rotation.s5 as attrib_wtre_Interp_int,
if(t_rotation.n1 is null or t_rotation.n1=0, NULL, cast(t_rotation.n1 as char(11))) as id_number,
if(t_rotation.n2 is null or t_rotation.n2=0, NULL, cast(t_rotation.n2 as char(11))) as attrib_CD_vorhanden,
if(t_rotation.n4 is null or t_rotation.n4=0, NULL, cast(t_rotation.n4 as char(11))) as attrib_Katpos_GEMA,
if(t_rotation.n5 is null or t_rotation.n5=0, NULL, cast(t_rotation.n5 as char(11))) as attrib_Labelcode_GEMA,
t_rotation.s6 as attrib_Ensemble_intern,
t_rotation.s7 as attrib_Dirigent_intern,
t_rotation.s8 as attrib_Interprt_GEMAGVL,
t_rotation.s9 as attrib_Besetzung_GEMA,
t_rotation.s10 as attrib_Arrangeur_intern,
if(t_rotation.n6 is null or t_rotation.n6=0, NULL, cast(t_rotation.n6 as char(11))) as attrib_Erscheinungsjahr,
if(t_rotation.n7 is null or t_rotation.n7=0, NULL, cast(t_rotation.n7 as char(11))) as attrib_GEMA_pflichtig,
t_rotation.s11 as attrib_Bearbeiter_GEMA,
t_rotation.s12 as attrib_Texter_GEMA,
t_rotation.s13 as attrib_Verlag_GEMA,
t_rotation.s14 as attrib_Gattung_GEMA_TXT,
t_rotation.s16 as attrib_Bestellnr_GEMA,
t_rotation.s17 as attrib_CD_Nummer,
t_rotation.s18 as attrib_ISRC_GEMA,
t_rotation.s19 as attrib_Katseite_GEMA,
t_rotation.s20 as attrib_Label_GEMA,
t_rotation.s21 as attrib_Biografie_intern,
t_rotation.s22 as attrib_Category_intern,
t_rotation.s23 as attrib_Run_time,
t_rotation.s27 as attrib_EAN_GEMA
from t_rotation
left outer join t_type on t_type.num_type=t_rotation.num_type
where t_rotation.num_rotation >= ([@part] * 1000) AND t_rotation.num_rotation < (([@part] * 1000)+1000)
order by t_type.name