...
ManagingDeanery to LocalOffice Mapping
vwLocalOffice to vwProgramme MD.xlsx
Code Block | ||||
---|---|---|---|---|
| ||||
select p.status, lop.LocalOfficeName, p.ProgrammeNumber, p.ProgrammeName, p.ManagingDeanery, case when p.ManagingDeanery = 'Health Education England North West' THEN 'HENW' when p.ManagingDeanery = 'Health Education England West Midlands' THEN 'HEWM' when p.ManagingDeanery = 'Health Education England Yorkshire and the Humber' THEN 'HEYH' when p.ManagingDeanery = 'Health Education England North East' THEN 'HENE' when p.ManagingDeanery = 'Health Education England East of England' THEN 'HEEOE' when p.ManagingDeanery IN ('Health Education England South West', 'Peninsula Local Office - HESW', 'Severn Local Office - HESW') THEN 'HESW' when p.ManagingDeanery IN ('Health Education England East Midlands', 'Yorkshire & Humber Deanery (North East)') THEN 'HEEM' when p.ManagingDeanery IN ('Health Education England Kent, Surrey and Sussex', 'London LETBs', 'Health Education England North West London', 'Health Education England North Central and East London', 'Health Education England South London') THEN 'HELASE' when p.ManagingDeanery IN ('Health Education England Wessex', 'Health Education England Thames Valley') THEN 'HEWTV' else 'UNKNOWN' end as mapped_lo from [HEELIVE].[vwProgramme] as p join [HEELIVE].[vwLocalOffice] as lop on (lop.ItemType = 'Programme' and lop.UniqueID = p.programmeid) --where status = 'Current' --and managingdeanery is not null order by 6,1,2 desc select p.status, lop.LocalOfficeName, p.ManagingDeanery, case when p.ManagingDeanery = 'Health Education England North West' THEN 'HENW' when p.ManagingDeanery = 'Health Education England West Midlands' THEN 'HEWM' when p.ManagingDeanery = 'Health Education England Yorkshire and the Humber' THEN 'HEYH' when p.ManagingDeanery = 'Health Education England North East' THEN 'HENE' when p.ManagingDeanery = 'Health Education England East of England' THEN 'HEEOE' when p.ManagingDeanery IN ('Health Education England South West', 'Peninsula Local Office - HESW', 'Severn Local Office - HESW') THEN 'HESW' when p.ManagingDeanery IN ('Health Education England East Midlands', 'Yorkshire & Humber Deanery (North East)') THEN 'HEEM' when p.ManagingDeanery IN ('Health Education England Kent, Surrey and Sussex', 'London LETBs', 'Health Education England North West London', 'Health Education England North Central and East London', 'Health Education England South London') THEN 'HELASE' when p.ManagingDeanery IN ('Health Education England Wessex', 'Health Education England Thames Valley') THEN 'HEWTV' else 'UNKNOWN' end as mapped_lo, count(*) as rc from [HEELIVE].[vwProgramme] as p join [HEELIVE].[vwLocalOffice] as lop on (lop.ItemType = 'Programme' and lop.UniqueID = p.programmeid) --where status = 'Current' --and managingdeanery is not null --order by 6,1,2 desc group by p.status, lop.LocalOfficeName, p.ManagingDeanery, case when p.ManagingDeanery = 'Health Education England North West' THEN 'HENW' when p.ManagingDeanery = 'Health Education England West Midlands' THEN 'HEWM' when p.ManagingDeanery = 'Health Education England Yorkshire and the Humber' THEN 'HEYH' when p.ManagingDeanery = 'Health Education England North East' THEN 'HENE' when p.ManagingDeanery = 'Health Education England East of England' THEN 'HEEOE' when p.ManagingDeanery IN ('Health Education England South West', 'Peninsula Local Office - HESW', 'Severn Local Office - HESW') THEN 'HESW' when p.ManagingDeanery IN ('Health Education England East Midlands', 'Yorkshire & Humber Deanery (North East)') THEN 'HEEM' when p.ManagingDeanery IN ('Health Education England Kent, Surrey and Sussex', 'London LETBs', 'Health Education England North West London', 'Health Education England North Central and East London', 'Health Education England South London') THEN 'HELASE' when p.ManagingDeanery IN ('Health Education England Wessex', 'Health Education England Thames Valley') THEN 'HEWTV' else 'UNKNOWN' end |
...