CREATE VIEW eventsviewplain
as
select
 cnt_useid,
 cnt_eventid,
 cnt_channelid,
 sub_eventid as imageid,
 cnt_source,
 all_updsp,
 cnt_updflg as updflg,
 cnt_delflg,
 cnt_fileref,
 cnt_tableid,
 cnt_version,
 sub_title,
 sub_comptitle,
 case
  when ifnull(sub_compshorttext,'') = '' or sub_comptitle=sub_compshorttext or ( substring(sub_compshorttext,1,1)='S' and  substring(sub_compshorttext,2,1) REGEXP ('[0-9]') ) then ''
 else sub_compshorttext
 end  sub_compshorttext,
 sub_complongdescription,
 case
  when ifnull(sub_shorttext,'') = '' or sub_comptitle=sub_compshorttext or ( substring(sub_shorttext,1,1)='S' and  substring(sub_shorttext,2,1) REGEXP ('[0-9]') ) then ''
 else sub_shorttext
 end sub_shorttext,
 cnt_starttime,
 cnt_duration,
 cnt_parentalrating,
 cnt_vps,
 cnt_contents,
 sub_imagecount,
 sub_genre,
 sub_category,
 sub_country,
 sub_year,
 sub_shortdescription,
 sub_shortreview,
 sub_tipp,
 sub_rating,
 sub_numrating,
 sub_txtrating,
 sub_topic,
 sub_longdescription,
 case when cnt_source != sub_source and sub_category not in('Serie','Spielfilm') then cnt_longdescription end cnt_longdescription,
 sub_moderator,
 sub_guest,
 sub_actor,
 sub_producer,
 sub_other,
 sub_director,
 sub_commentator,
 sub_screenplay,
 sub_camera,
 sub_music,
 sub_audio,
 sub_flags,
 sub_episodecompname,
 sub_episodecompshortname,
 sub_episodecomppartname,
 sub_scrseriesid,
 sub_scrseriesepisode,
 sub_scrmovieid,
 epi_episodename,
 epi_shortname,
 epi_partname,
 epi_lang,
 epi_extracol1,
 epi_extracol2,
 epi_extracol3,
 epi_season,
 epi_part,
 epi_parts,
 epi_number,
 case when cnt_source <> sub_source then concat(upper(replace(cnt_source,'vdr','dvb')),'/',upper(sub_source)) else upper(replace(cnt_source,'vdr','dvb')) end merge
from
 useevents
where
 cnt_updflg in('A','L','P');
