Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

LocalOfficeNameProgrammeNumberProgrammeNameProgName
HEYHCHESTERFIELD STGP 015CHERSTERFIELD ST1 PROGRAMME 15CHESTERFIELD 
HEYHTrent FP 047047 - 2008 startersTrent 
HEYHTrent FP 008008 - 2009/10 startersTrent 
HEYHTrent FP 090090 - 2008/9/10 startersTrent 
HEYHTrent FP 048048 - 2008/9/10 startersTrent 
HEYHTrent FP 010010 - 2008/9/10 startersTrent 
HEYHTrent FP SA2 - 2008SA2 - 2008Trent 
HEYHTrent FP 086086 - 2008/9/10 startersTrent 
HEYHTrent FP 029029 - 2008/9/10 startersTrent 
HEYHTrent FP 027027 - 2008/9 startersTrent 
HEYHTrent FP 068(Ac)068(Ac) - 2009/10 startersTrent 
HEYHTrent FP 002002 - 2009/10 startersTrent 
HEYHTrent FP 013013 - 2008 startersTrent 
HEYHTrent FP 056056 - 2008/9 startersTrent 
HEYHTrent FP 031031 - 2008/9 startersTrent 
HEYHTrent FP 036036 - 2008/9 startersTrent 
HEYHRotation 49NGH F1Rotation 


...

ManagingDeanery to LocalOffice Mapping

Code Block
sql
sql
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

...