Version : 10609
DB : MSSQL
OUTPUT:
select "ad"."ORG_NAME" AS "Account",
"sdorg"."NAME" AS "Site",
case when hop.starttime = '00:00:00' and hop.endtime = '23:59:00' then 'Yes' else 'No' END as "24 Hours (Y/N)",
hop.starttime as "Start time",
hop.endtime as "End time",
STUFF((SELECT ', '+ dop.weekday + char(10) FROM daysofoperation dop
where ophdef.operationalhoursdefid = dop.operationalhoursdefid FOR XML PATH ('')), 1, 1, '') 'Working Days' from AccountDefinition ad
left join SiteDefinition sdef on ad.defaultsiteid = sdef.siteid
Left JOIN SDOrganization sdorg on sdef.siteid = sdorg.org_id
Left JOIN operationalhoursdef ophdef on sdef.siteid = ophdef.siteid
Left JOIN hoursofoperation hop on ophdef.operationalhoursdefid = hop.operationalhoursdefid