-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sql
33 lines (26 loc) · 822 Bytes
/
test.sql
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
#referer - site table
SELECT DISTINCT ReferralHealthCareProfessional
,ReferralHealthAuthorityHospitalSite
FROM referral
GROUP BY referral.ReferralCaseID;
#site - HA, source table
SELECT DISTINCT ReferralHealthAuthorityHospitalSite
,ReferralHealthAuthority
,ReferralSource
FROM referral
GROUP BY referral.ReferralCaseID;
DROP TABLE IF EXISTS hasite;
CREATE TABLE DeliveryRate (DeliveryFeeID int PRIMARY KEY
,EquipmentID int
,DeliveryZone int
,DeliveryRate FLOAT
);
#site - HA, source table
CREATE TABLE HealthAuthoritySite AS
SELECT DISTINCT ReferralHealthAuthorityHospitalSite
,ReferralHealthAuthority
,ReferralSource
FROM referral
GROUP BY referral.ReferralCaseID
ORDER BY ReferralSource
,ReferralHealthAuthorityHospitalSite