-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathreferrerTypeGroupings.sql
More file actions
62 lines (51 loc) · 1.43 KB
/
referrerTypeGroupings.sql
File metadata and controls
62 lines (51 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* This query groups up the case_referrer_org_type field into 9 categories. */
select
case
when LEFT(case_referrer_org_type, 9) = 'Surestart'
then 'Surestart'
when case_referrer_org_type in
('Tenancy Support',
'Tenancy Support Services')
then 'Tenancy Support Services'
when case_referrer_org_type in
('Local Education Authority Services',
'Lea Services',
'College',
'Community School',
'Connexions/Careers')
then 'Education Services'
when case_referrer_org_type in
('Probation',
'Probation/Young Offending Service')
then 'Probation'
when case_referrer_org_type in
('Social Services (Inc Hospital)',
'Social Services/Childrens Trusts',
'Other La Services E.G. Community Services',
'Other Local Authority Services',
'Joint Partnerships')
then 'Social Services'
when case_referrer_org_type in
('Local Authority Housing',
'Housing Associations',
'Housing Associations / La Housing')
then 'Housing'
when case_referrer_org_type in
('Health Services',
'Community Health Services')
then 'Health and Community Services'
when case_referrer_org_type in
('Voluntary Sector',
'Voluntary Organisation')
then 'Voluntary Sector'
when case_referrer_org_type is null or
case_referrer_org_type in
('Individuals',
'Joint Partnership',
'Clergy/Churches',
'Other')
then 'Other'
else 'UNKNOWN'
end as ReferrerType
from
Buttle.dbo.case_application