Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

For Discussion 

#

Comment
Owner
1Should Site Number & Name be unique ?
Alistair Pringle (Unlicensed)

Break down of SiteNumber and SiteName NULL or NOT NULL values;

select CASE WHEN SiteName IS NULL THEN 'NULL' ELSE 'NOT NULL' END SiteName, 
	   CASE WHEN SiteNumber IS NULL THEN 'NULL' ELSE 'NOT NULL' END SiteNumber, status, count(*) 
from [HEELIVE].[vwSite] 
group by CASE WHEN SiteName IS NULL THEN 'NULL' ELSE 'NOT NULL' END, 
	   CASE WHEN SiteNumber IS NULL THEN 'NULL' ELSE 'NOT NULL' END, status


SiteNameSiteNumberstatusRowCount
NOT NULLNOT NULLCurrent7419
NOT NULLNULLCurrent817
NOT NULLNULLInactive243
NOT NULLNOT NULLInactive5265


Total13744


There are 12 SiteNames that have been duplicated, of which 5 have a Current Status;

select SiteName, SiteNumber, status, count(*) 
from [HEELIVE].[vwSite]
group by SiteName, SiteNumber, status
having count(*) > 1
order by 3, 4 desc
SiteNameSiteNumberstatusRowCount
Dental SurgeryNULLCurrent7
Health CentreNULLCurrent2
Overseas HospitalNULLCurrent2
Park SurgeryNULLCurrent2
The Medical CentreNULLCurrent2
Kings Park HospitalNULLInactive3
15a Derby roadNULLInactive2
1A Welbeck RoadNULLInactive2
Doctors SurgeryNULLInactive2
ExNULLInactive2
Gloucestershire Royal HospitalRTE03Inactive2
Poole General Hospital (Dorset HC)NULLInactive2


Further details on the 5 duplicates;

select lo.LocalOfficeName, s.*
from [HEELIVE].[vwSite] as s
left join [HEELIVE].[vwLocalOffice] as lo ON (lo.itemtype = 'Site' and lo.UniqueID = s.SiteID)
where status = 'Current'
and ISNULL(SiteName, -1) + ISNULL(SiteNumber,-2) in (select ISNULL(SiteName, -1) + ISNULL(SiteNumber,-2)
													   from [HEELIVE].[vwSite] 
													   where status = 'Current'
													   group by SiteName, SiteNumber
													   having count(*) > 1)
order by SiteName, SiteNumber


LocalOfficeNameRecordOriginStatusSiteNameSiteKnownAsSiteNumberTrustSiteIDTrustIDAddressLine1AddressLine2AddressLine3AddressLine4AddressPostCodeWard
HENEHEELIVECurrentDental SurgeryDC Daniels Dental PracticeNULLDurham, Darlington and Tees Area Team109759701974190761 Roman RoadLinthorpeNULLMiddlesbroughTS5 5PHNULL
HENEHEELIVECurrentDental SurgeryRyton Dental ClinicNULLCumbria, Northumberland, Tyne and Wear Area Team129334111463562629 Dean TerraceRytonNewcastle upon TyneTyne and WearNE40 3HQNULL
HENEHEELIVECurrentDental SurgerySunderland Road Dental PracticeNULLCumbria, Northumberland, Tyne and Wear Area Team1626301914635626265 Sunderland RoadSouth ShieldsNULLTyne and WearNE34 6ALNULL
HENEHEELIVECurrentDental SurgeryGrange Dental CentreNULLCumbria, Northumberland, Tyne and Wear Area Team169972091463562659-61 Great North RoadGosforthNewcastle upon TyneTyne and WearNE3 2DQNULL
HENEHEELIVECurrentDental SurgeryStanley Dental PracticeNULLDurham, Darlington and Tees Area Team192838441974190713 Front StreetStanleyNULLCounty DurhamDH9 0JENULL
HENEHEELIVECurrentDental SurgeryChandlers Lane Dental PracticeNULLCumbria, Northumberland, Tyne and Wear Area Team213560141463562652 Front StreetBramptonNULLNULLCA8 1NTNULL
HENEHEELIVECurrentDental SurgerySouthview Dental CareNULLCumbria, Northumberland, Tyne and Wear Area Team221658351463562646 SouthviewEast DentonNewcastle upon TyneTyne and WearNE5 2BPNULL
HENWHEELIVECurrentHealth CentreHealth CentreNULLNULL246651307NULLCollege StreetLeighNULLNULLNULLNULL
HENWHEELIVECurrentHealth CentreHealth CentreNULLNULL246651406NULLLondon StreetFleetwoodNULLNULLFY7 6WDNULL
NULLHEELIVECurrentOverseas HospitalOverseasNULLNULL33319953NULLNULLNULLNULLNULLNULLNULL
HESWHEELIVECurrentOverseas HospitalOverseasNULLNULL36090048NULLNULLNULLNULLNULLNULLNULL
HENWHEELIVECurrentPark SurgeryPark SurgeryNULLNULL246651460NULL8 Alexandra Road SouthWhalley RangeManchesterNULLM16 8ERNULL
HENWHEELIVECurrentPark SurgeryPark SurgeryNULLNULL246651316NULL434 Altrincham RoadBaguleyWythenshaweManchesterM23 9ABNULL
HENWHEELIVECurrentThe Medical CentreThe Medical CentreNULLNULL246651687NULL25 South King StreetBlackpoolNULLNULLFY1 4NFNULL
HENWHEELIVECurrentThe Medical CentreThe Medical CentreNULLNULL246651251NULLMarket StreetWhitworthRochdaleLancsOL12 8QSNULL

Red rows above signify that the LocalOffice field has not been set for these site rows, and probably being done to aid the filtering out of these duplicated Sites


  • No labels