CREATE OR REPLACE VIEW thenetworkcallbackview as select i.clientnum, i.incidentid, incidentnum, incidenttypeid, incidentdate, subjectid, subjecttypeid, locationid, suspectedactivity.value as description, situation, policenotified, injuries, injurednum, injuriesdescription, propertydamage, damagelevelid, incidentreport, i.transfered, i.transftypeid, i.transfdate, i.transfbyid, i.transfnum, lastmodified, createdbyid,i.isdeleted, workflowstatus, cashloss, merchloss, totloss, markettypeid, typeofweaponid, alarmid, cameraid, escalated, transcount, orgcalldate_time, anoncaller, callernamefirst as firstname, callernamelast as lastname, callernamefirst || ' ' || callernamelast as callernamelast, callertype, callertitle, callerphone, callerext, callerbesttimetocall, calleremail, clientname, location, dba, address1, address2, city, state, zip, country, phone, ext, abuselocation, casesource.value as hoiwincdknown, supportdocsavailable, next24hours, nextwhen, nextwhere, howhotlineknown, interviewernotes, clientinstructions, case when i.statusid is null then 'none' when i.statusid = 1 then 'open' when i.statusid = 2 then 'closed' end as status,i.assignedto, cb.callbackdate, substring(cb.callbacknotes,1,20) as callbacknotes from tblincident i inner join tblincidentcallback cb on i.incidentnum = cb.incidentid and i.clientnum = cb.clientnum left outer join tblcasesource casesource on i.inccasesourceid = casesource.id and (i.clientnum=casesource.clientnum) left outer join tblsuspectedactivity suspectedactivity on i.incsuspectedactivityid = suspectedactivity.id and (i.clientnum=suspectedactivity.clientnum);