Hallo Zusammen;
ich habe folgendes Select erstellt:
Passt alles so weit. Allerdings möchte ich in den Subselect ein Case When einfügen. Und zwar soll er mir als Mail_Status den Listagg ausgeben, wenn das t.maildate befüllt ist. Wenn t.maildate leer ist dann möchte ich den Eintrag '"no E-Mail correspondence" ausgeben lassen.
funktioniert nicht. Kann mir jemand helfen? Vielen Dank schon mal!
ich habe folgendes Select erstellt:
Code:
Select x.kd_nr, x.name, x.vorname, (select distinct listagg (t.maildate|| ': ' || r.company_name ||'; ') within group (order by T.maildate) from company r join timeline t on (r.company_id = t.adressid) join timeline_sent ts on (t.timeline_id = ts.timeline_id) where x.kd_nr = t.kd_nr)MAIL_STATUS from Kunde X Where x.bestelldatum > ‘20160101’;
Code:
Select x.kd_nr, x.name, x.vorname, (select distinct case when t.mailingdate is null then "NO E-MAIL CORRESPONDENCE" else listagg (t.maildate|| ': ' || r.company_name ||'; ') within group (order by T.maildate) from company r join timeline t on (r.company_id = t.adressid) join timeline_sent ts on (t.timeline_id = ts.timeline_id) where x.kd_nr = t.kd_nr)MAIL_STATUS from Kunde X Where x.bestelldatum > ‘20160101’;
Comment