SELECT chdt.changeid "Change ID",
chdt.title "Title",
Longtodate(chdt.createdtime) "Created Time",
Longtodate(chdt.scheduledstarttime) "Scheduled Start Time",
Longtodate(chdt.scheduledendtime) "Scheduled End",
Longtodate(chdt.completedtime) "Completed Time",
orgaaa.first_name "Requested by",
ownaaa.first_name "Technician",
priodef1.priorityname "Priority",
urgdef.NAME "Urgency",
ctdef.NAME "Change Type",
stagedef.NAME "Change Status",
approvaldef.statusname "Approval Status",
catadef.categoryname "Category",
subcatadef.NAME "Subcategory",
itemdef1.NAME "Item",
chandes.full_description "Description",
cr.rolloutplan "Roll Out Plan",
cr.backoutplan "Back Out Plan",
cr.impactdesc "Impact Descritpion",
cr.checklist "Check List",
cr.review "Review",
sdo.NAME "Site" FROM changedetails chdt
LEFT JOIN sduser orgsd
ON chdt.initiatorid=orgsd.userid
LEFT JOIN aaauser orgaaa
ON orgsd.userid=orgaaa.user_id
LEFT JOIN sduser ownsd
ON chdt.technicianid=ownsd.userid
LEFT JOIN aaauser ownaaa
ON ownsd.userid=ownaaa.user_id
LEFT JOIN prioritydefinition priodef1
ON chdt.priorityid=priodef1.priorityid
LEFT JOIN urgencydefinition urgdef
ON chdt.urgencyid=urgdef.urgencyid
LEFT JOIN changetypedefinition ctdef
ON chdt.changetypeid=ctdef.changetypeid
LEFT JOIN stagedefinition stagedef
ON chdt.stageid=stagedef.stageid
LEFT JOIN approvalstatusdefinition approvaldef
ON chdt.appr_statusid=approvaldef.statusid
LEFT JOIN categorydefinition catadef
ON chdt.categoryid=catadef.categoryid
LEFT JOIN subcategorydefinition subcatadef
ON chdt.subcategoryid=subcatadef.subcategoryid
LEFT JOIN itemdefinition itemdef1
ON chdt.itemid=itemdef1.itemid
LEFT JOIN changeresolution changeResol
ON chdt.changeid=changeresol.changeid
LEFT JOIN changetocharge changeCharge
ON chdt.changeid=changecharge.changeid
LEFT JOIN chargestable chargeTable
ON changecharge.chargeid=chargetable.chargeid
LEFT JOIN aaauser ownaaa1
ON chargetable.technicianid=ownaaa1.user_id
LEFT JOIN changetodescription chandes
ON chdt.changeid=chandes.changeid
LEFT JOIN sitedefinition siteDef
ON chdt.siteid=sitedef.siteid
LEFT JOIN sdorganization sdo
ON sitedef.siteid=sdo.org_id
LEFT JOIN changeresolution cr
ON chdt.changeid=cr.changeid
WHERE chdt.createdtime >= <from_thisweek>
AND chdt.createdtime <= <to_thisweek>